winstoon

Simple Wrapper for Winston Logger

npm install winstoon
2 downloads in the last week
32 downloads in the last month

winstoon Build Status

Very Simple Wrapper Over winston logger

which provides few functionalities which winston does not offer

  • simple logger creation for multiple contexts
  • add transports to all created loggers
  • set root log level for all created loggers

Install

npm install winstoon

Usage

var winstoon = require('winstoon');
var logger = winstoon.createLogger('logger-name');

logger.info('this is a info message', { tag: 'tag-value'})

Add transports

This needs to done at once on your source and applies to all

winstoon.add(winstoon.transports.Console);

Other transports available

winstoon inherits all the transports available at winston

set root log level

It's very important to switch from the different log levels at different stage of the application. You can choose your root log level as follows

winstoon.setRootLevel('debug'); //only show logs levels higher than info

Shorthand logger creation

var logger = require('winstoon')('logger-name');

Common Tags instead of the logger name

It is possible to configure a set of common tags for a logger, which always get logged.

var logger = require('winstoon')({context: 'name', host: 'host123'});

log level priorities can be found here

  • fatal
  • error
  • warn
  • info
  • debug
  • log
npm loves you