debug-logfmt

1.2.2 • Public • Published

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 · Twitter @Kikobeats

Dependencies (4)

Dev Dependencies (18)

Package Sidebar

Install

npm i debug-logfmt

Weekly Downloads

9,861

Version

1.2.2

License

MIT

Unpacked Size

6.72 kB

Total Files

4

Last publish

Collaborators

  • kikobeats