Skip to content

Commit

Permalink
LIG-1080 - Allow setting of default data
Browse files Browse the repository at this point in the history
  • Loading branch information
astilla authored Nov 1, 2016
1 parent 422a487 commit 46aac1c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 2.1.4 (2016-11-01)

Improvement:

- Add setDefaultData(obj) to allow certain data to be logged on every logger call. (e.g. logging of user details)

## 2.1.3 (2016-10-26)

Bug fix:
Expand Down
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.3",
"version": "2.1.4",
"main": "./js/logging.js",
"description": "Client side logging sent to the server",
"repository": {
Expand Down
10 changes: 10 additions & 0 deletions js/logging.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ loggingModule.factory(
*/
var overrideLoggingThreshold = false;

/*
* Allows the calling code to set some default data that will get logged on
* every call to applicationLoggingService.
*/
var defaultData = null;

var isLoggingEnabledForSeverity = function(severity) {
var iRequestedLevel = arrLoggingLevels.indexOf(severity);
if (iRequestedLevel === -1) {
Expand Down Expand Up @@ -142,6 +148,7 @@ loggingModule.factory(
url: $window.location.href,
message: message,
desc: desc,
defaultData: defaultData,
overrideLoggingThreshold: overrideLoggingThreshold
})
});
Expand Down Expand Up @@ -174,6 +181,9 @@ loggingModule.factory(
iLoggingThreshold = arrLoggingLevels.indexOf(level);
overrideLoggingThreshold = true;
}
},
setDefaultData: function(data) {
defaultData = data;
}
});
}]
Expand Down

0 comments on commit 46aac1c

Please sign in to comment.