A dead simple logger. Will log to STDOUT or STDERR depending on the chosen log level. It uses console.info
, console.warn
and console.error
and hence supports the same API.
Log levels supported: trace, debug, info, warn, error and fatal.
Installationnpm install console-log-level
Example usage
Optionsvar log = require('console-log-level')({ level: 'info' })
Â
log.trace('a')Â
log.debug('b')Â
log.info('c')Â Â
log.warn('d')Â Â
log.error('e')Â
log.fatal('f')Â
Configure the logger by passing an options object:
levelvar log = require('console-log-level')({
  prefix: function (level) {
    return new Date().toISOString()
  },
  level: 'info'
})
A string
to specify the log level. Defaults to info
.
Specify this option if you want to set a prefix for all log messages. This must be a string
or a function
that returns a string.
Will get the level of the currently logged message as the first argument.
stderrA boolean
to log everything to stderr. Defauls to false
.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4