colored-fancy-log

fancy-log but with colors!

Uses fancy-log and colors to create time-stamped, colored, and (optionally) named loggers.

Installation

Using npm:

npm i --save @fizzygalacticus/colored-fancy-log

Using yarn:

yarn add --save @fizzygalacticus/colored-fancy-log

Usage

By default, colored-fancy-log exports a logger with no name to be used immediately:

const logger = require('@fizzygalacticus/colored-fancy-log');

logger.success('Hello, world!');

Output:

output-1

To name a logger:

const { getLogger } = require('@fizzygalacticus/colored-fancy-log');
const logger = getLogger({ name: 'test-logger' });

logger.success('Hello, world!');

Output:

output-2

Don't like the default name <-> message separator? You can change that too!

const { getLogger } = require('@fizzygalacticus/colored-fancy-log');
const logger = getLogger({ name: 'test-logger', separator: '=>' });

logger.success('Hello, world!');

Output:

output-3

Available Functions

Name Output
log log-example
info info-example
lame lame-example
success success-example
warn warn-example
error error-example
evil evil-example
enable Sets logger to enabled
disable Sets logger to disabled (won't print anything)
toggleEnabled Toggles loggers enabled variable
setEnabled Sets loggers enabled variable