Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Simple logging with Winston and Universe
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
.gitignore
.travis.yml
README.md
index.js
package.json
test.js

README.md

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

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',
        /* … */
    };
});
Something went wrong with that request. Please try again.