bunyan-stream

Stream data into a bunyan logger

Usage no npm install needed!

<script type="module">
  import bunyanStream from 'https://cdn.skypack.dev/bunyan-stream';
</script>

README

node-bunyan-stream stability

npm version build status test coverage downloads js-standard-style

Stream data into a bunyan logger. Allows fine grained control over what is logged from a stream.

Installation

$ npm install bunyan-stream

Usage

const bunyanStream = require('bunyan-stream')
const httpNdjson = require('http-ndjson')
const bunyan = require('bunyan')

const logger = bunyan.createLogger({ name: 'myApp' })

http.createServer((req, res) => {
  httpNdjson(req, res).pipe(bunyanStream({ level: 'info' }, logger))
  res.end()
}).listen()

API

bunyanStream

Create a new bunyan writestream (instanceof through2). opts can contain the following values:

  • level: the log level. One of debug, info, warn, error

See Also

License

MIT