Forked from https://github.com/Ideame/winston-rollbar and updated to support latest reporter and maintain longer term.
Thanks also to GorillaStack for previously keeping an updated fork: https://github.com/GorillaStack/winston-rollbar
A rollbar transport for winston.
$ npm install winston-rollbar2
var winston = require("winston");
// Requiring `winston-rollbar2` will expose
// `winston.transports.Rollbar`
//
require("winston-rollbar2");
winston.add(winston.transports.Rollbar, {
rollbarAccessToken: "API_TOKEN"
rollbarConfig: {
environment: "development"
}
});
The Rollbar transport uses rollbar.js behind the scenes. Options are the following:
- rollbarAccessToken: Rollbar post server item access token.
- rollbarConfig: Rollbar configuration (more info) (optional).
- level: Level of messages this transport should log. (default: warn).
- silent: Boolean flag to disable reporting to Rollbar. (default: false).
To use Rollbar's request logging include the key request with the value of the request object to report.
app.use("/", (req, res) => {
winston.error("request example", {request: req});
});