From f56d9f0a9bfc8073a765de327646452c436bf36f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Og=C3=B3rek?= Date: Tue, 8 May 2018 12:23:09 +0200 Subject: [PATCH] ref: use console.warn for alerts and store them in Set --- .eslintrc | 1 + lib/utils.js | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.eslintrc b/.eslintrc index d277d0b..3170e87 100644 --- a/.eslintrc +++ b/.eslintrc @@ -2,6 +2,7 @@ "env": { "node": true, "mocha": true, + "es6": true }, "rules": { "block-scoped-var": 2, diff --git a/lib/utils.js b/lib/utils.js index fec4945..7e4b8af 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -15,7 +15,7 @@ var protocolMap = { https: 443 }; -var consoleAlerts = {}; +var consoleAlerts = new Set(); // Default Node.js REPL depth var MAX_SERIALIZE_EXCEPTION_DEPTH = 3; @@ -125,14 +125,14 @@ module.exports.disableConsoleAlerts = function disableConsoleAlerts() { module.exports.consoleAlert = function consoleAlert(msg) { if (consoleAlerts) { - console.log('raven@' + ravenVersion + ' alert: ' + msg); + console.warn('raven@' + ravenVersion + ' alert: ' + msg); } }; module.exports.consoleAlertOnce = function consoleAlertOnce(msg) { - if (consoleAlerts && !(msg in consoleAlerts)) { - consoleAlerts[msg] = true; - console.log('raven@' + ravenVersion + ' alert: ' + msg); + if (consoleAlerts && !consoleAlerts.has(msg)) { + consoleAlerts.add(msg); + console.warn('raven@' + ravenVersion + ' alert: ' + msg); } };