From 27ae526d5467db76208193e2aa1e80ad69d164d4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksander=20=C5=81ukasz?= Date: Mon, 30 Dec 2013 13:57:56 +0100 Subject: [PATCH 1/1] logging: Raven handler fixes - pass logger name - pass level not as a tag (this overwrites default "level" tag value in Sentry UI instead of setting its second value) - allow for passing additional data when logging exception --- src/fnpjs/logging/handlers.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/fnpjs/logging/handlers.js b/src/fnpjs/logging/handlers.js index c5b6990..cc2eab1 100644 --- a/src/fnpjs/logging/handlers.js +++ b/src/fnpjs/logging/handlers.js @@ -10,16 +10,21 @@ return { return; } - var ravenData = {}; + var ravenData = { + level: record.level, + logger: record.loggerName, + tags: {} + }; + + Object.keys(record.data || {}) + .filter(function(key) {return key !== 'exception';}) + .forEach(function(key) { + ravenData.tags[key] = record.data[key]; + }); if(record.data.exception) { - window.Raven.captureException(record.data.exception); + window.Raven.captureException(record.data.exception, ravenData); } else { - Object.keys(record.data || {}).forEach(function(key) { - ravenData[key] = record.data[key]; - }); - ravenData.tags = ravenData.tags || {}; - ravenData.tags.level = record.level; window.Raven.captureMessage(record.message, ravenData); } } -- 2.20.1