@brickyard/logger
v0.0.3
Published
a logger for brickyard with time format
Downloads
27
Readme
brickyard logger
Install
npm i @brickyard/logger
Usage
const logger = require('@brickyard/logger')
// logger.Level: TRACE, DEBUG, INFO, WARN, ERROR
logger.setLevel(logger.Level.TRACE)
const console = logger.console
console.trace('this is trace level log')
console.debug('this is debug level log')
console.log('this is log level log')
console.info('this is info level log')
console.warn('this is warn level log')
console.error('this is error level log')
or
const logger = require('@brickyard/logger')
// logger.Level: TRACE, DEBUG, INFO, WARN, ERROR
logger.setLevel(logger.Level.TRACE)
// pass param true to hack, false to restore, default true
logger.hackConsole()
console.trace('this is trace level log')
console.debug('this is debug level log')
console.log('this is log level log')
console.info('this is info level log')
console.warn('this is warn level log')
console.error('this is error level log')
output
[T 180314 09:41:39.600 +0800] this is trace level log
[D 180314 09:41:39.654 +0800] this is debug level log
[I 180314 09:41:39.697 +0800] this is log level log
[I 180314 09:41:39.708 +0800] this is info level log
[W 180314 09:41:39.717 +0800] this is warn level log
[E 180314 09:41:40.527 +0800] this is error level log