Registry / observability / logdown

logdown

JSON →
library3.3.1jsnpmunverified

logdown is a versatile JavaScript debug utility designed for both browser and Node.js environments, providing a consistent logging interface with built-in Markdown formatting support. Currently stable at version 3.3.1, the library maintains a fairly active release cadence within its major version 3, introducing enhancements such as custom transports, optimized bundle sizes through Webpack, improved cross-environment compatibility, and modular internal architecture. Its key differentiators include automatic Markdown parsing for log messages, seamless delegation to native console methods, and compatibility with standard debugging mechanisms like Node.js's `NODE_DEBUG` environment variable and browser `localStorage.debug`. The library is lightweight, with the browser version having no external dependencies and a minimal gzipped footprint, making it suitable for performance-sensitive applications.

npm install logdown
INSTALL
IMPORT
SIG · LOGDOWN
L
logdown
observabilityjavascriptv3.3.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

logdown
import logdown from 'logdown';
import { logdown } from 'logdown';
The library primarily exports a default function for ESM consumers. Named imports are not used for the main logger factory.
logdown
const logdown = require('logdown');
const { logdown } = require('logdown');
For CommonJS, the module exports a function directly. This pattern has been stable since at least v2.1.0.
logger instance
const logger = logdown('my-prefix');
const logger = new logdown('my-prefix');
logdown is a factory function; it should be called directly with its configuration, not instantiated with `new`.

Initializes a logdown logger with a prefix, demonstrates enabling logs programmatically, and showcases various logging methods with Markdown formatting, including multi-argument logging and disabling Markdown.

import logdown from 'logdown'; // Initialize a logger with a unique prefix (e.g., your module name) const myLogger = logdown('my-app:feature'); // By default, logs are disabled unless activated via environment variables or explicitly // For demonstration, we'll enable it directly. myLogger.state.isEnabled = true; // Log messages with Markdown formatting myLogger.log('Hello, *world*! This is a simple log message.'); myLogger.info('This is _information_ about something important.'); myLogger.warn('A `warning` occurred, perhaps an API call failed gracefully.'); myLogger.error('An **error** was encountered: `process.exit(1)`'); // Multiple arguments are supported, similar to console.log myLogger.log('User:', { id: 123, name: 'John Doe' }, 'action:', 'logged in'); // You can also disable markdown per-logger instance const rawLogger = logdown({ prefix: 'raw-output', markdown: false }); rawLogger.log('This *will not* be parsed as markdown.'); rawLogger.state.isEnabled = true;
Debug
Known issues
gotchaLogs are disabled by default and will not appear unless explicitly enabled. This is consistent with `debug.js` and `util.debuglog` behavior.
fix
Enable logging via Node.js environment variable `NODE_DEBUG=your-prefix` (supports wildcards and comma-separated prefixes), browser `localStorage.debug = 'your-prefix'`, or programmatically set `logger.state.isEnabled = true;`.
affects: >=2.0.0
gotchaMarkdown parsing is enabled by default for `logdown` messages. If your log strings contain asterisks (`*`), underscores (`_`), or backticks (`` ` ``) that are intended to be literal rather than formatting, they will be parsed as bold, italic, or code respectively.
fix
Either escape the Markdown characters (e.g., `\*literal\*`) or disable Markdown parsing for a logger instance by passing `{ markdown: false }` in the options: `logdown({ prefix: 'my-app', markdown: false })`.
affects: >=2.0.0
gotchaWhile `logdown` provides `log`, `info`, `warn`, `error` methods with Markdown support, other `console` methods (e.g., `dir`, `table`, `group`) are delegated directly to the original `console` object or custom transports without `logdown`'s special formatting or Markdown parsing.
fix
Be aware that complex `console` methods will behave as standard `console` calls. Use the dedicated `logdown` methods for formatted output.
affects: >=3.1.0
gotchaColor rendering can vary significantly across different terminal emulators and browser developer tools. Although `logdown` includes fixes for specific environments (e.g., VSCode terminal in v3.0.2, Microsoft Edge in v3.2.2), perfect consistency across all environments is challenging.
fix
Test `logdown` output in your target environments. Ensure your terminal supports true color or ANSI escape codes for optimal display.
affects: >=2.0.0
Errors
Common errors & fixes
No logs are appearing in my console/terminal even after calling `logger.log()`.
By default, logdown loggers are disabled. You need to explicitly enable them.
fix
For Node.js, run your application with `NODE_DEBUG=your-prefix node app.js`. For browsers, set `localStorage.debug = 'your-prefix'` in the browser's developer console. Alternatively, for a specific logger, set `logger.state.isEnabled = true;`.
My log messages like 'My *item* is here' are showing 'My **item** is here' (bolded) instead of 'My *item* is here' (with literal asterisks).
Markdown parsing is enabled by default and interprets the asterisks as bold formatting.
fix
To prevent Markdown parsing, initialize your logger with the `markdown: false` option: `const logger = logdown({ prefix: 'my-app', markdown: false });`.
I'm trying to import `logdown` using `import { logdown } from 'logdown'` but it's not working or throwing an error.
The `logdown` package exports a default function, not named exports for its primary functionality.
fix
Use a default import: `import logdown from 'logdown';`.
Upgrade
Version history
3.3.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
10 hits · last 30 days
node
8
OpenAI (training)
2
Resources
logdown — npm install logdown · libregistry