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

Commit

Permalink
Merge pull request #61 from BonnierNews/feature/add-severity-to-log
Browse files Browse the repository at this point in the history
add severity to logs
  • Loading branch information
antero-k authored Dec 18, 2023
2 parents dbfe23d + cd86448 commit 36a3675
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
11 changes: 11 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,16 @@ function metaDataFormat(info) {
return info;
}

function addSeverity(info) {
let level = info.level.toUpperCase();
if (level === "VERBOSE") {
level = "DEBUG";
}

info.severity = level;
return info;
}

function defaultFormatter() {
return format.printf((info) => {
const meta = Object.keys(info).reduce(
Expand Down Expand Up @@ -101,6 +111,7 @@ const logger = winston.createLogger({
exitOnError: appConfig.envName !== "production",
format: format.combine(
format.metadata({ key: "metaData" }),
format(addSeverity)(),
format(splatEntry)(),
format(truncateTooLong)(),
format(cleanEntry)(),
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"Markus Ekholm",
"Jens Carlén"
],
"version": "7.1.1",
"version": "7.2.0",
"engines": {
"node": ">=16 <=18",
"yarn": "please use npm"
Expand Down

0 comments on commit 36a3675

Please sign in to comment.