Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bunyan-opbeat

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bunyan-opbeat

Bunyan stream for Opbeat

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

bunyan-opbeat

Bunyan stream for Opbeat

Build Status js-standard-style

Install

# install bunyan
$ npm i --save bunyan

# install bunyan-opbeat
$ npm i --save bunyan-opbeat

Use

var bunyan = require('bunyan')
var BunyanOpbeat = require('bunyan-opbeat')

var log = bunyan.createLogger({
  name: 'my-logger',
  streams: [
    {
      level: 'warn',
      type: 'raw', // <-- this is mandatory so bunyan-opbeat gets the log as an object
      stream: new BunyanOpbeat({
        config: {
          appId: '...',
          organizationId: '...',
          secretToken: '...',
          // you can also add any other parameter that opbeat module accepts, it will be passed on
        }
      })
    }
  ]
})

log.error(new Error('whoops'))

Alternatively, if you've already started an opbeat instance somewhere else in your code, you can pass it directly to bunyan-opbeat and it will use it instead:

var bunyan = require('bunyan')
var BunyanOpbeat = require('bunyan-opbeat')
var opbeat = require('opbeat').start({
  appId: '...',
  organizationId: '...',
  secretToken: '...'
})

var log = bunyan.createLogger({
  name: 'my-logger',
  streams: [
    {
      level: 'warn',
      type: 'raw', // <-- this is mandatory so bunyan-opbeat gets the log as an object
      stream: new BunyanOpbeat({
        client: opbeat
      })
    }
  ]
})

log.error(new Error('whoops'))
  • note: bunyan-opbeat requires opbeat client version >= 4.8.0

How does it work?

bunyan-opbeat reads data coming from your bunyan logger and uses opbeat.captureError() to post it to Opbeat. It will do it's best to pass on some common fields like user, time, hostname and level. Anything else in your logs that opbeat can't understand will be passed as an extra field

Keywords

FAQs

Package last updated on 12 Feb 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc