Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
A Simple Wrapper for Winston
JavaScript
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
test
.gitignore
.travis.yml
LICENSE
package.json
readme.md

readme.md

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
Something went wrong with that request. Please try again.