Skip to content

Simple logger with automatic context (file + line). Zero dependencies.

License

Notifications You must be signed in to change notification settings

promise-inc/devlog

Repository files navigation

devlog

Simple logger with automatic context (file + line). Zero dependencies.

devlog output

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/devlog

Usage

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
  • Browserconsole.groupCollapsed with %c styling. 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.

About

Simple logger with automatic context (file + line). Zero dependencies.

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published