Skip to content

Commit

Permalink
Cleanup rollbar args
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Nason committed Nov 7, 2017
1 parent 9ba9e0d commit 1ea3b8f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/util/client/rollbarLogger.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,14 @@ export default function ClientRollbarLogger({ token, environment, codeVersion })
*/
ClientRollbarLogger.prototype.write = function (data = {}) {
const rollbarLevelName = bunyanLevelToRollbarLevelName(data.level);
const scopeData = omit(data, ['req', 'level']);
const scopeData = omit(data, ['err', 'level']);
const payload = Object.assign({ level: rollbarLevelName }, scopeData);

// https://rollbar.com/docs/notifier/rollbar.js/#rollbarlog
const logFn = global.Rollbar[rollbarLevelName];
if (isFunction(logFn)) {
logFn.call(global.Rollbar, data.msg, data.err, scopeData);
logFn.call(global.Rollbar, data.msg, data.err, payload);
} else {
global.Rollbar.error(data.msg, data.err, scopeData);
global.Rollbar.error(data.msg, data.err, payload);
}
};
2 changes: 1 addition & 1 deletion src/util/server/rollbarLogger.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default function ServerRollbarLogger({ token, codeVersion, environment })
*/
ServerRollbarLogger.prototype.write = function (data = {}) {
const rollbarLevelName = bunyanLevelToRollbarLevelName(data.level);
const scopeData = omit(data, ['req', 'level']);
const scopeData = omit(data, ['req', 'err', 'level']);
const payload = Object.assign({ level: rollbarLevelName }, scopeData);

// https://rollbar.com/docs/notifier/rollbar.js/#rollbarlog-1
Expand Down

0 comments on commit 1ea3b8f

Please sign in to comment.