Permalink
Browse files

Fixup server rollbar logger

  • Loading branch information...
Mike Nason
Mike Nason committed Nov 7, 2017
1 parent 243ee3d commit 7fe98f9603cf28394d9fed4d8aeaa92aaef7e9e1
Showing with 3 additions and 5 deletions.
  1. +3 −5 src/util/server/rollbarLogger.js
@@ -12,15 +12,13 @@ import { bunyanLevelToRollbarLevelName } from '../common/rollbar';
*/
export default function ServerRollbarLogger({ token, codeVersion, environment }) {
// https://rollbar.com/docs/notifier/rollbar.js/#quick-start-server
const rollbar = new Rollbar({
this._rollbar = new Rollbar({
accessToken: token,
captureUncaught: true,
captureUnhandledRejections: true,
code_version: codeVersion,
environment,
});
return rollbar;
}
/**
@@ -37,11 +35,11 @@ ServerRollbarLogger.prototype.write = function (data = {}) {
const payload = Object.assign({ level: rollbarLevelName }, scopeData);
// https://rollbar.com/docs/notifier/rollbar.js/#rollbarlog-1
const logFn = Rollbar[rollbarLevelName];
const logFn = this._rollbar[rollbarLevelName];
if (isFunction(logFn)) {
logFn(data.msg, data.err, data.req, payload);
} else {
Rollbar.error(data.msg, data.err, data.req, payload);
this._rollbar.error(data.msg, data.err, data.req, payload);
}
};

0 comments on commit 7fe98f9

Please sign in to comment.