nm-logger

0.0.2-2 • Public • Published

nm-logger

nm-logger is a wrapper around Winston logger for NodeJS. For every log call it automatically adds the date and time as well as the file name and line number at which the log message was executed.

The following parameters can be configured via the "init" function call:

logToConsole - whether you want to log everything to the console as well logLevel - as supported by Winston (e.g. debug, info, error, warn). If none is specified, log level is set to error filePath - absolute path to log file. If none is specified, the file path is set to /tmp/nm-logger.log

maxsize - file max size. The default is 50MB maxFiles - max number of log files. The default is 10

Usage

Installing

npm install nm-logger

A basic example for using nm-logger.

 var loggerManager = require('nm-logger');

 loggerManager.init({logToConsole:true, filePath:'/tmp/example.log', logLevel:'debug'});  

var logger = loggerManager.getLogger();  

logger.debug('This is a debug message');

The code above will produce the following message:

debug: 2013/09/20 21:23:49:653 : example1.js:8 : This is a debug message

Readme

Keywords

none

Package Sidebar

Install

npm i nm-logger

Weekly Downloads

3

Version

0.0.2-2

License

none

Last publish

Collaborators

  • noam-malter