Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gui/bunyan-rollbar
A Bunyan stream plugin to send error logs to Rollbar
https://github.com/gui/bunyan-rollbar
Last synced: 16 days ago
JSON representation
A Bunyan stream plugin to send error logs to Rollbar
- Host: GitHub
- URL: https://github.com/gui/bunyan-rollbar
- Owner: GUI
- License: mit
- Created: 2014-11-04T05:55:08.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2014-11-04T05:56:25.000Z (about 10 years ago)
- Last Synced: 2024-10-31T17:46:25.061Z (17 days ago)
- Language: JavaScript
- Size: 117 KB
- Stars: 5
- Watchers: 6
- Forks: 8
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# bunyan-rollbar
If you're using [Bunyan](https://github.com/trentm/node-bunyan) for logging,
this custom stream can be used to send your error logs to
[Rollbar](https://rollbar.com).## Example
```js
var bunyan = require('bunyan'),
bunyanRollbar = require('bunyan-rollbar');var logger = bunyan.createLogger({
name: 'mylogger',
streams: [
{
level: 'warn',
type: 'raw', // Must be set to raw for use with BunyanRollbar
stream: new bunyanRollbar.Stream({
rollbarToken: 'YOUR_ROLLBAR_ACCESS_TOKEN',
rollbarOptions: {} // Additional options to pass to rollbar.init()
}),
},
],
});
```## Serializers
If you plan to use Bunyan's standard
[serializers](https://github.com/trentm/node-bunyan#serializers), it's
recommended you use the standard serializers from this library instead. You
should also overwrite `bunyan.stdSerializers.err` with the version from this
library. The serializers provided by this library include all the same standard
serializers as Bunyan, but are modified to retain the original error and
request objects so Rollbar can apply its own custom processing to those
specific types of objects.```js
// Override
bunyan.stdSerializers.err = bunyanRollbar.stdSerializers.err;
var logger = bunyan.createLogger({
name: 'mylogger',
serializers: bunyanRollbar.stdSerializers,
})
```