loglevel is a minimal, lightweight logging library for JavaScript environments, including browsers and Node.js. Currently at version 1.9.2, it maintains a steady release cadence focusing on stability and reliability. Its core functionality extends standard `console.log` methods to provide level-based logging (trace, debug, info, warn, error) and filtering, while gracefully handling environments where `console` methods might be absent or limited. Key differentiators include its small footprint (1.4 KB minified and gzipped), lack of external dependencies, preservation of original stack trace line numbers (unlike many wrapper-heavy logging frameworks), and seamless integration with various module systems (CommonJS, AMD, global). It ships with built-in TypeScript definitions and ensures consistent logging behavior across diverse JavaScript runtimes, making it a reliable choice for everyday debugging without introducing complex features like appender reconfiguration or advanced filtering rules.
npm install loglevelVerified import paths — ran on the pinned version, not inferred.
Demonstrates basic usage of loglevel, including setting log levels dynamically and outputting messages at various severities.
Call `log.setLevel('trace');` or `log.enableAll();` at the beginning of your application to see all messages. For development, `log.setLevel('debug');` is often sufficient.Be aware of this limitation when developing custom log handlers. For most use cases, the built-in methods are sufficient to preserve stack traces.
Upgrade to loglevel `1.6.4` or newer to resolve webpack build problems related to module resolution.
Avoid using loglevel `1.6.5`. Upgrade to `1.6.6` or a newer version to prevent compatibility problems in Node.js and older IE browsers.
Upgrade to loglevel `1.6.3` or newer to benefit from fixes that prevent TypeScript type conflicts with other global `log` definitions.
Call `log.setLevel('debug');` (or 'info', 'trace', 'all') at the start of your application, for example, `import log from 'loglevel'; log.setLevel('debug');`.Update your `loglevel` package to `1.6.4` or a newer version: `npm install loglevel@latest`.
Upgrade `loglevel` to version `1.6.3` or higher: `npm install loglevel@latest`.
No dependency data recorded yet.