3.0.2 • Published 5 years ago

console-logfmt v3.0.2

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

console-logfmt

Wrap around logfmt exposing a interface compatible with console.log(), console.warn() and console.error().

Instalation

npm install console-logfmt

Usage

The level is defined as:

  • log()'info'
  • warn()'warn'
  • error()'error'

Any string parameter will be concatenated to the msg= key:

const ConsoleLogFmt = require('console-logfmt')
const { log, warn, error } = new ConsoleLogFmt()

log('message')
// output:
// level=info msg=message

log('message', 'of something')
// output:
// level=info msg="message of something"

Any object parameter wil be passed to the logfmt as it is:

warn('message of warning', { extra: 'data' })
// output
// level=warn msg="message of warning" extra=data
error({ other: 'message of error', extra: 'data' })
// output
// level=error other="message of error" extra=data

Important to notice

The default output for any log level is the process.stderr, if you need something different, the console parameters still valid to be informed/replaced.

License

console-logfmt is released under the MIT License.

3.0.2

5 years ago

3.0.1

5 years ago

2.0.0

5 years ago

1.0.0

5 years ago