Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

loglevel-colored-level-prefix

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

loglevel-colored-level-prefix

loglevel plugin that adds colored level prefix (node only)

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
881K
decreased by-1.95%
Maintainers
1
Weekly downloads
 
Created

What is loglevel-colored-level-prefix?

The loglevel-colored-level-prefix package is an extension for the loglevel logging library that adds colored level prefixes to log messages. This helps in distinguishing log levels visually, making it easier to read and debug logs.

What are loglevel-colored-level-prefix's main functionalities?

Colored Level Prefixes

This feature adds colored prefixes to log messages based on their level (info, warn, error, etc.). The colors help in quickly identifying the severity of the messages.

const log = require('loglevel');
const prefix = require('loglevel-colored-level-prefix');

prefix.apply(log);

log.info('This is an info message');
log.warn('This is a warning message');
log.error('This is an error message');

Custom Prefix Format

This feature allows you to customize the format of the log message prefixes. You can define a template that includes the log level, timestamp, and message.

const log = require('loglevel');
const prefix = require('loglevel-colored-level-prefix');

prefix.apply(log, {
  template: '[%l] %t: %m',
  level: 'info'
});

log.info('This is an info message');
log.warn('This is a warning message');
log.error('This is an error message');

Custom Colors

This feature allows you to customize the colors used for different log levels. You can use any color supported by the chalk library.

const log = require('loglevel');
const prefix = require('loglevel-colored-level-prefix');

prefix.apply(log, {
  level: 'info',
  format: {
    info: chalk.blue,
    warn: chalk.yellow,
    error: chalk.red
  }
});

log.info('This is an info message');
log.warn('This is a warning message');
log.error('This is an error message');

Other packages similar to loglevel-colored-level-prefix

Keywords

FAQs

Package last updated on 27 Feb 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc