Minimal lightweight logging for JavaScript, adding reliable log level methods to wrap any available console.log methods.
loglevel is a minimal, lightweight logging library for JavaScript that adds reliable log level methods to wrap any available console.log methods. It solves the problem of inconsistent console logging across different environments by providing a simple, level-based API that works everywhere, from modern browsers and Node.js to older environments like IE8/9.
JavaScript developers who need a simple, reliable logging solution that works across all environments without breaking their application, especially those building libraries, modules, or applications that must run in diverse browser and Node.js contexts.
Developers choose loglevel for its tiny size, reliability, and simplicity—it provides essential logging features without the bloat, ensures logging never fails even in edge cases, and preserves stack traces for better debugging.
:ledger: Minimal lightweight logging for JavaScript, adding reliable log level methods to wrap any available console.log methods
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Works in all JavaScript environments, including older browsers like IE8/9, with graceful fallbacks that prevent application breaks even if the console object is missing.
Directly binds to console methods to keep line numbers intact in browser dev tools, unlike wrappers that clobber stack traces for better debugging.
At 1.4 KB minified and gzipped with no dependencies, it adds negligible overhead to your bundle, keeping applications lightweight.
Easy API to set log levels with persistence via localStorage or cookies, allowing dynamic filtering from trace to silent across sessions.
Lacks built-in log formatting, remote sending, or complex filtering; extensions require plugins that can compromise stack traces and add complexity.
Log formatting varies by console implementation, e.g., trace messages in Firefox before version 64 don't include custom text, leading to inconsistent debugging experiences.
Using plugins for added functionality, like prefixing or remote logging, often clobbers stack traces by wrapping methods, undermining a key benefit of the core library.