/lazy-logger

a simple wrapper for winston and winston-daily-rotate-file that i use as a logger for fast prototyping. Ideal for lazy people.

Primary LanguageJavaScriptMIT LicenseMIT

lazy-logger

Version npmnpm DownloadsBuild StatusDependencies Known Vulnerabilities NPM

a simple wrapper for winston and winston-daily-rotate-file that i use as a logger for fast prototyping. Ideal for lazy people. This module is just a lazy way to switch from the default console to winston while adding simple daily log files.

If you need a proper module to handle your logging, head over to winston

Installation

npm install lazy-logger

Usage

The LazyLogger constructor accepts 4 arguments

  1. The Winston Logging level as indicated by winston check the module's documentation for more. NOTE 1. can be 'silly','debug','verbose','info','warn','error'
  2. Boolean that dictates the creation of a daily rotating file
  3. In case 2. is true a path will be required to store the log files
  4. the date format of the date that will be part of the logfile name
var LazyLogger= new require('lazy-logger');
//initialize a logger object with info level of debug, a path, and a pattern for date
var logger= new LazyLogger('silly',true,'./log-','yyyy-MM-dd');


logger.silly('Silly level');

logger.debug('Debug level');

logger.verbose('Verbose level');

logger.info('Info level');

logger.warn('Warn level');

logger.error('Error level');