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

color-loggers

Package Overview
Dependencies
Maintainers
0
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

color-loggers

Print to console with colors.

  • 0.3.1
  • npm
  • Socket score

Version published
Weekly downloads
4.7K
decreased by-39.39%
Maintainers
0
Weekly downloads
 
Created
Source

color loggers

Print to console with colors.

Install

yarn add color-loggers

Use

import { Blue, Green, Red } from 'color-loggers';

const info = new Blue();
const success = new Green();
const error = new Red();

info.log('This is an information.');
success.log('Congratulations!');
error.log('Something is wrong!');

Sample output

Change the prefix

const info = new Blue('👉');
const success = new Green('🎉');
const error = new Red('⛔️');

info.log('This is an information.');
success.log('Congratulations!');
error.log('Something is wrong!');

Dynamic prefix

const info = new Blue(() => `[${new Date()}]:`);
info.log('This is an information.');

Output:

 [Thu Mar 02 2023 11:37:55 GMT-0800 (Pacific Standard Time)]: This is an information.

Choose another color

import { Color } from 'color-loggers';
import Styles from 'color-loggers/styles';

const logger = new Color(Styles.FgWhite, '');
logger.log('This is a white text.');

Disable logger

const logger = new Color(Styles.FgWhite, '');
logger.disable();
logger.log('This is a white text.'); // will not be printed

FAQs

Package last updated on 21 Jul 2024

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