Skip to content

hugnosis/log4js-simple

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

log4js-simple

NPM

Usage

var log = require('log4js-simple');

log.info('Hello %s', world);
log.warn('Hello %s', world);
log.error('Hello %s', world);
log.fatal('Hello %s', world);

Log Format

util.format

Change Level

/** ['ALL', 'TRACE', 'DEBUG', 'INFO', 'WARN', 'ERROR', 'FATAL', 'OFF'] */
log.level = 3; // INFO;

Change Levels

var levels = ['ALL', 'INFO', 'WARN', 'ERROR'];
log.setLevels(levels [, level=2 [, displayCallstackLevel=2 [, displayErrorLevel=3]);

log.all('all message'); // Not display
log.warn('call stack display ...');
log.error('error message');

Change prefix

log.prefix = function(level) {
  /** 2016-11-03T08:39:35.943Z INFO */
  return (new Date()).toISOString() + ' ' + levels[level];
}

Installation

$ npm i log4js-simple

About

Javascript Simple log

Resources

License

Stars

Watchers

Forks

Packages

No packages published