1.0.0 • Published 9 years ago

sioslife-logger v1.0.0

Weekly downloads
2
License
MIT
Repository
-
Last release
9 years ago

sioslife-logger

Simple, colorful logging by siosLIFE.

Installation

npm install --save sioslife-logger

Usage

Create a logger:

var Logger = require('sioslife-logger');
var logger = Logger('My App');

This logger has the methods log, warn and error. It also has a modifier for each style in chalk.

Use it like this:

logger.log('Starting');
//=> [My App] Starting

logger.green.log('Started');
// Writes in green to console.log:
//=> [My App] Started

// These write to console.error instead:
logger.red.error('Something bad happened');
logger.bgRed.error('Something very bad happened');

It's also possible to create loggers for sub-domains of your application:

var Logger = require('sios-logger');
var dbLogger = Logger('My App', 'DB');

dbLogger.log('Connecting');
//=> [My App]:[DB] Connecting

License

MIT © siosLIFE