Skip to content

Commit

Permalink
Merge pull request #13 from talis/ELE-3189-log-filter
Browse files Browse the repository at this point in the history
ELE-3189 Callback check to allow errors to be filtered
  • Loading branch information
pogotc authored Mar 16, 2020
2 parents cdcb159 + 6f7f500 commit 1e6557f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "app-logger-angular",
"version": "2.1.8",
"version": "2.2.0",
"main": "./js/logging.js",
"description": "Client side logging sent to the server",
"repository": {
Expand Down
9 changes: 9 additions & 0 deletions js/logging.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ loggingModule.factory(
$log.error.apply($log, arguments);
}

if($window.talisLogger.onBeforeLogError && !$window.talisLogger.onBeforeLogError(exception)) {
return false;
}

if (LOGGING_CONFIG.FORWARD_TO_NEWRELIC && $window.NREUM && $window.NREUM.noticeError) {
$window.NREUM.noticeError(exception);
}
Expand Down Expand Up @@ -95,6 +99,7 @@ loggingModule.factory(
var arrLoggingLevels = ['trace', 'debug', 'info', 'warn', 'error'];
var loggingThreshold = LOGGING_CONFIG.LOGGING_THRESHOLD || 'info';
var iLoggingThreshold = arrLoggingLevels.indexOf(loggingThreshold);
$window.talisLogger = {};

/*
* If we've told applicationLoggingService to override the logging threshold set in config then also pass
Expand Down Expand Up @@ -139,6 +144,10 @@ loggingModule.factory(
}
}

if($window.talisLogger.onBeforeLogError && !$window.talisLogger.onBeforeLogError(message)) {
return false;
}

if (sendToNewRelic && $window.NREUM && $window.NREUM.noticeError) {
$window.NREUM.noticeError(message, {desc: desc});
}
Expand Down

0 comments on commit 1e6557f

Please sign in to comment.