Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Commit

Permalink
ref: use console.warn for alerts and store them in Set
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilogorek committed May 8, 2018
1 parent 381dd6f commit f56d9f0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"env": {
"node": true,
"mocha": true,
"es6": true
},
"rules": {
"block-scoped-var": 2,
Expand Down
10 changes: 5 additions & 5 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
};

Expand Down

0 comments on commit f56d9f0

Please sign in to comment.