wigos

Simple logging with Winston and Universe

npm install wigos
2 downloads in the last week
2 downloads in the last month

Wigos brings together Universe and winston to make project logging a snap.

In other words: Winston Goes to Outer Space!

Basic usage is as follows:

var wigos = require('wigos');
var log = wigos('access');
log.info('GET /foobar');

The logger returned is a regular winston logger. Wigos keeps track of loggers by name, returning the same object every time, and centrally manages transports on all loggers.

By default, logging is enabled to the console with level info, and to files in the project's log directory with level verbose. Log files are given the .log extension.

The default transports can be toggled on-the-fly:

wigos.logToConsole(false);
wigos.logToFiles(false);

Custom transports can also be added or removed from all loggers:

wigos.addTransport(MyTransport, { level: 'info' });
wigos.removeTransport(MyTransport);

Note that addTransport doesn't take transport instances, only constructor functions, unlike winston's Logger#add. This is because an instance needs to be created for every wigos logger.

Rather than an options hash, you may also provide a function. The function takes as its only argument the logger name requested. For example, the default file logger is created roughly as follows:

wigos.addTransport(winston.transports.File, function(basename) {
    return {
        dirname: universe.log,
        filename: basename + '.log',
        /* … */
    };
});
npm loves you