I’ve been through a lot of different logging libraries in Node.js for different projects, but Winston is the one I always come back to. Winston is asynchronous, offers support for multiple transports, and is damned easy to get set up.

First, add it to your dependencies:

"dependencies": {
  "winston": "~ 0.5.10"
}

The basic usage would be just as you’d imagine:

var winston = require('winston');

winston.info('this is some info');
winston.debug('a debug message');

You can also attach meta info to any log call, so that your calls can not have to block on building up custom strings:

winston.log('listening on ' + host + ':' + port); // old
winston.log('listening', { host: host, port: port }); // new

Its easy to configure and create custom logger objects too. I love how simple the whole thing is. I have a few commits on winston, and it’s inspired the work I’ve done so far on iolog (a similar logging library for Io).