Highway to the logging zone

Kenny Loggins

var loggins = require('kenny-loggins');'oh hey'); // totally cool!

The default loggins is already piped to stdout, but if you want a clean one go for it:

var kenny = loggins();

It takes an optional arguments hash with values:

  • opts.levels: Either a list of levels, or key-value pairs of the form <level>: <color>.

This returns a stream which outputs pretty-printed logging events.

logger will have a method for every level. For example:'this is some info'); is also a readable/writable stream. As a writable stream, it will log each chunk as a logging message. As a readable stream, it just emits the log messages.

logger.raw is the same as 'logger' except the chunks are in JSON format.

logger._pretty is used to format an object with the keys "level" and "message". You can punch this to customize what prettiness looks like. By default colorizes the message if logger.colors[level] is defined, using some copypasta from the colors library to avoid punching the prototype (looking for a better solution!!!).

  1. Way way way better docs
  2. Special cases for formatting errors?
  3. Unpipe?