{"library":"loglevel-colored-level-prefix","title":"Loglevel Colored Level Prefix","description":"The `loglevel-colored-level-prefix` package is a specialized plugin for the `loglevel` library, designed to enhance log output in Node.js environments by adding colored prefixes to log levels. Released as `v1.0.0` in February 2017, this utility provides a stable, opinionated solution for visually distinct logging but is not under active development, operating effectively in a maintenance-only status. It explicitly leverages the `chalk` library for terminal colorization, making it a Node.js-exclusive tool and unsuitable for browser environments. Its primary differentiator is offering a consistent, pre-formatted log style specifically for Node.js applications, aiding in quick identification of log severity. The package exposes a single function, `getLogger`, which returns a singleton `loglevel` instance, configured with a specified prefix and initial log level, providing a focused approach to colored console output within the `loglevel` ecosystem.","language":"javascript","status":"maintenance","last_verified":"Sun Apr 19","install":{"commands":["npm install loglevel-colored-level-prefix"],"cli":null},"imports":["const getLogger = require('loglevel-colored-level-prefix')","const getLogger = require('loglevel-colored-level-prefix')","const logger = getLogger({ prefix: 'APP', level: 'info' })"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"const getLogger = require('loglevel-colored-level-prefix');\n\n// Options can include 'prefix' (string) and 'level' (string: trace, debug, info, warn, error)\nconst options = { prefix: 'MY_APP', level: 'trace' };\nconst logger = getLogger(options);\n\nlogger.trace('Tracing execution flow. Data: %o', { user: 'test', id: 123 });\nlogger.debug('Debugging an issue. Variable X is: %d', 42);\nlogger.info('User logged in. ID: %s', 'user-abc-123');\nlogger.warn('Deprecated API call detected in module: %s', 'old-module');\nlogger.error('Critical error occurred! Stack: %s', new Error('Something went wrong').stack);\n\n// Subsequent calls with the same prefix will return the same logger instance\nconst anotherLogger = getLogger({ prefix: 'MY_APP' });\nlogger.info('This is the same logger instance as before:', logger === anotherLogger);","lang":"javascript","description":"Initializes and demonstrates logging at different levels using `getLogger` with colored prefixes in a Node.js environment.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}