1.2.1 • Published 8 years ago

log-color-plusplus v1.2.1

Weekly downloads
9
License
-
Repository
github
Last release
8 years ago

Log.js (with added vitamins for pep and vigor)

This package is based on log-color-optionaldate.js which is a fork of log-color.js which it itself a fork of Log.js.

Installation

Install using npm:

$ npm install log-color-plusplus

Example

Can be used in a similar fashion to Log.js.

Code snippet:

var Log = require('log');
var log = new Log('info');
log.info('Sent a message to the user@example.com');

Enabling Color/Wrapping

Enable color/wrapping like this:

var Log = require('log-color-plusplus');
var log = new Log({ 
  level: 'debug', 
  color: true, 
  date: false,
  wrap: true, // Turn word wrap on.
  width: 50 // Wrap at 50 chars.
});
log.warning('Failed to send a message to the user@example.com');

Log Levels

The same log levels are available as in Log.js, with one addition:

log.alert('alert');
log.critical('critical');
log.error('error');
log.warning('warning');
log.notice('notice');
log.info('info');
log.debug('debug'); 
log.print('print'); // Added. Will print a string without a 'level' preceeding it.