0.0.4 • Published 10 years ago

log_ v0.0.4

Weekly downloads
1
License
MIT
Repository
github
Last release
10 years ago

log_

console.log + color + prefix for node.js

Installation

npm install --save log_

Usage

var log = require('log_')('server', 'blue');

// Basic logging
log('starting on port 8080');

// Error messages
log.warn('server crashed!');

This logs the following:

Available Colors

var Log = require('log_');
console.log(Log.colors);

// outputs the following
{
  'reset':      '\u001b[0m',
  'bold':       '\u001b[1m',
  'italic':     '\u001b[3m',
  'underline':  '\u001b[4m',
  'blink':      '\u001b[5m',
  'black':      '\u001b[30m',
  'red':        '\u001b[31m',
  'green':      '\u001b[32m',
  'yellow':     '\u001b[33m',
  'blue':       '\u001b[34m',
  'magenta':    '\u001b[35m',
  'cyan':       '\u001b[36m',
  'white':      '\u001b[37m'
}

Enabling and Disabling

var Log, log;

Log = require('log_');
log = Log('test', 'green');

log('enabled by default');

Log.disable();
log('disabling the logs');
log.warn('no one can hear you');

Log.enable();
log('enable the logs again');