debug-logfmt
Highlights
- Based on
debug
, use DEBUG
for enable/disable logging. - Expose
info
, warn
and error
logging levels, inspired from RFC 5424. - Format messages using Heroku logfmt syntax.
Install
$ npm install debug-logfmt --save
const debug = require('debug-logfmt')
const log = debug('metascraper')
log.debug('retry', { url: req.url })
log.info('done', { time: ms('1 hour') })
log.warn('token expired', { timestamp: Date.now() })
log.error('whoops', { message: error.message })
API
debug(env, [options])
env
Required
Type: string
The env variable name to use for enabling logging using DEBUG
.
options
levels
Type: array
Default: ['debug', 'info', 'warn', 'error']
The log levels available.
License
debug-logfmt © Kiko Beats, released under the MIT License.
Authored and maintained by Kiko Beats with help from contributors.
kikobeats.com · GitHub Kiko Beats · X @Kikobeats