logdna-bunyan

2.0.3 • Public • Published

[![All Contributors](https://img.shields.io/badge/all_contributors-7-orange.svg?style=flat-square)](#contributors-)

Node.js Bunyan library for logging to LogDNA


Install

$ npm install --save logdna-bunyan

API

Please see @logdna/logger for instantiation options to passthrough to LogDNA's logger client.

Logging to LogDNA Through Bunyan

This module provides an interface that can be hooked into Bunyan and used as a transport to LogDNA. Since @logdna/logger is also an EventEmitter, please make use of the reemitErrorEvents provided by Bunyan so that the implementor can be aware of errors in the LogDNA client. Not doing so will cause Bunyan to throw if @logdna/logger emits an 'error'.

const {createLogger} = require('bunyan')
const LogDNAStream = require('logdna-bunyan')

const logDNA = new LogDNAStream({
  key: apikey
}) // See @logdna/logger for more constructor options

const logger = createLogger({
  name: "My Application"
, streams: [
    {
      stream: process.stdout
    }
  , {
      stream: logDNA
    , type: 'raw'
    , reemitErrorEvents: true // Bubble up 'error' events from @logdna/logger
    }
  ]
})

logger.info('Starting application on port %d', app.get('port'))

NOTE: You must use the raw stream type, and also reemitErrorEvents must be true. Otherwise, errors emitted by @logdna/logger will throw Bunyan.

Contributors

Thanks goes to these wonderful people (emoji key):


Muaz Siddiqui

💻 📖

Samir Musali

💻 📖

Darin Spivey

💻 📖 🔧

vilyapilya

💻 🔧

s100

💻

Bartek R.

💻

Mike Del Tito

💻 🔧

This project follows the all-contributors specification. Contributions of any kind welcome!

License

Copyright © LogDNA, released under an MIT license. See the LICENSE file and https://opensource.org/licenses/MIT

Happy Logging!

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
2.0.31,580latest

Version History

VersionDownloads (Last 7 Days)Published
2.0.31,580
2.0.28
2.0.11
2.0.00
1.3.25
1.3.11
1.3.00
1.2.042
1.1.616
1.1.50
1.1.40
1.1.30
1.1.20
1.1.10
1.1.00
1.0.10
1.0.00

Package Sidebar

Install

npm i logdna-bunyan

Weekly Downloads

1,653

Version

2.0.3

License

SEE LICENSE IN LICENSE

Unpacked Size

12.3 kB

Total Files

5

Last publish

Collaborators

  • svenlogdna
  • muaz
  • logdna-user
  • darinspivey