ts-bunyan-rollbar

ts-bunyan-rollbar repo

Usage no npm install needed!

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

README

ts-bunyan-rollbar

Simple (0 dependencies) Rollbar adapter for Bunyan written in TypeScript

import Rollbar from 'rollbar'
import BunyanLogger from 'bunyan'
import { RollbarStream } from 'ts-bunyan-rollbar'

const rollbar = new Rollbar({
  accessToken: 'token',
  captureUncaught: true,
  captureUnhandledRejections: true
})

const logger = new BunyanLogger({
  name: 'ts-bunyan-rollbar',
  streams: [
    {
      level: 'info',
      type: 'raw',
      stream: new RollbarStream(rollbar)
    }
  ]
})

logger.error({ x: 'extra', err: new Error('some error message') }, 'abcd')

logger.info({ y: 'extra' }, 'abcedf')

logger.info('abcedf')