Skip to content

Commit

Permalink
fix: warning for not logging errors for error and fatal levels (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
venetahristova authored and kalinkrustev committed Apr 17, 2018
1 parent 1e270e4 commit 33ab557
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 7 additions & 0 deletions modules/bunyan.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ function Bunyan(options) {
logData.push(data[0]);
}
lib.transformData(logData);
if ((level === 'error' || level === 'fatal') && !(data[0] instanceof Error)) {
var err = new Error();
log.warn({
logMessage: data[0],
stack: err.stack.split('\n').splice(3).join('\n')
}, `A js exception must be logged for the levels 'error' and 'fatal'`);
}
log[level].apply(log, logData);
}

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"bunyan": "1.8.12",
"bunyan-logstash": "0.3.4",
"bunyan-logstash-tcp": "1.0.0",
"lodash.assign": "4.2.0",
"lodash.clonedeepwith": "4.5.0",
"lodash.defaultsdeep": "4.6.0",
"readable-stream": "2.3.3",
Expand All @@ -24,10 +23,10 @@
"fs-plus": "3.0.2"
},
"peerDependencies": {
"ut-bus": "^6.0.0"
"ut-bus": "^6.2.0"
},
"devDependencies": {
"ut-tools": "^5.24.0"
"ut-tools": "^5.32.8"
},
"optionalDependencies": {
"gelf-stream": "1.1.1",
Expand All @@ -43,6 +42,7 @@
"release": "ut-release",
"changelog": "ut-changelog",
"check": "ut-check",
"precover": "ut-precover",
"cover": "ut-cover",
"lint-js": "ut-lint-js .",
"postpublish": "ut-postpublish",
Expand Down

0 comments on commit 33ab557

Please sign in to comment.