This is a
playground to test code. It runs a full
Node.js environment and already has all of
npm’s 400,000 packages pre-installed, including
kenny-loggins with all
npm packages installed. Try it out:
This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.
var loggins = require('kenny-loggins'); loggins.info('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(); loggins.pipe(fs.createWriteStream('./log.log'));
It takes an optional arguments hash with values:
opts.levels: Either a list of levels, or key-value pairs of the form
This returns a stream which outputs pretty-printed logging events.
logger will have a method for every level. For example:
logger.info('this is some info');
logger.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
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!!!).