node package manager
It’s your turn. Help us improve JavaScript. Take the 2017 JavaScript Ecosystem Survey »

nodeswork-logger

nodeswork-logger

Wrapper of winston logger, shared between nodeswork repos.

Installation

$ npm i -S nodeswork-logger

How to use

Nodeswork Logger uses object's properties to create new winston instances each time when the logger reference being called. This is because we set label to the actual file path of the caller. So for performance consideration, reference the logger object at the top of the file where it is used.

Default Logger

{logger} = require('nodeswork-logger');
 
logger.info("This is a test log.");
logger.error("Want to see an error log.");

Create new logger using customized transports

winston  = require 'winston'
nwLogger = require 'nodeswork-logger'
 
nwLogger.addLogger 'requestLog'transports: [
  nwLogger.transport winston.transports.Console{
    colorize: true
  }
]
 
{requestLog} = require 'nodeswork-logger'
 
requestLog.info "Another one without timestamp."