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 logdownVerified import paths — ran on the pinned version, not inferred.
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.
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;`.
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 })`.Be aware that complex `console` methods will behave as standard `console` calls. Use the dedicated `logdown` methods for formatted output.
Test `logdown` output in your target environments. Ensure your terminal supports true color or ANSI escape codes for optimal display.
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;`.
To prevent Markdown parsing, initialize your logger with the `markdown: false` option: `const logger = logdown({ prefix: 'my-app', markdown: false });`.Use a default import: `import logdown from 'logdown';`.
No dependency data recorded yet.