@promise-inc/devlog
v0.1.9
Published
Simple logger with automatic context (file + line)
Maintainers
Readme
Why?
Standard console.log tells you nothing about where a log came from:
- No file name, no line number
- No visual distinction between info, warnings, and errors
- No way to disable debug logs in production
- Scattered
console.log("here")everywhere
devlog adds automatic context to every log — file, line, and level — with zero configuration.
Install
npm install @promise-inc/devlogUsage
import { log } from "@promise-inc/devlog";
log.info("User created", { userId: 42 });
log.warn("Deprecated method");
log.error("Failed to save", err);
log.success("Migration complete");
log.debug("Cache hit", { key: "users:1" });Custom instance
import { createLogger } from "@promise-inc/devlog";
const logger = createLogger({
enabled: true,
debugEnabled: false,
});
logger.info("Custom logger");Environment variables
| Variable | Effect |
|----------|--------|
| DEVLOG_ENABLED=false | Disables all logs |
| DEVLOG_ENABLED=true | Enables all logs including debug |
| NODE_ENV=production | Disables debug level (unless DEVLOG_ENABLED=true) |
Output
- Node.js — Colored output with ANSI escape codes
- Browser —
console.groupCollapsedwith%cstyling. Data nested inside collapsible groups
How to report bugs
To report a bug, please first read our guide on opening issues.
How to contribute code
To open a pull request, please first read our guide on opening pull requests, which outlines our process for RFCs and pull requests.
Also by Promise Inc.
| Package | Description |
|---------|-------------|
| @promise-inc/ai-guard | Detect AI-generated code patterns |
| @promise-inc/ps-guard | Lighthouse-based performance guard |
| @promise-inc/fs-guard | Validate project folder and file structure |
| @promise-inc/ui-states | Auto-generated skeleton loading states |
| @promise-inc/dev-reel | Animated SVG previews for READMEs |
Developed by Promise Inc.
License
MIT © Promise Inc.
