Skip to content

pajaydev/log-cli

Repository files navigation

log-cli

Build Status

A simple logger for node cli, it wraps around chalk and ora package.

Installation

npm install log-cli

or

yarn add log-cli

Usage:

const Logger = require('log-cli')

const logger = new Logger();
logger.log('this is normal message');
// prints the success message in green color
logger.success('this is success message');
// prints the message with the default prefix
logger.success('this is success message', true);

Examples

Methods

warn, success, error, log, info, bold, spin, spinStart, spinStop

Change the default colors of logging

Default color mapping

{
    "error": "red",
    "info": "cyan",
    "warn": "yellow",
    "success": "green"
}

You can override colors using the setColor method like below

logger.setColor({info: 'grey'});

credits.