From aaebb611a1bd759ff9d14302c46be5030d33f4f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antero=20K=C3=A4rki?= Date: Mon, 18 Dec 2023 09:09:41 +0100 Subject: [PATCH 1/3] add severity to logs --- index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/index.js b/index.js index 89d80eb..1806c97 100644 --- a/index.js +++ b/index.js @@ -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( @@ -109,6 +119,7 @@ const logger = winston.createLogger({ format(location)(), format(metaDataFormat)(), format(debugMetaFormat)(), + format(addSeverity)(), formatter ), }); From ae5e8e0e6d43e5fa938a8c7fbc138d0a91a78cb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antero=20K=C3=A4rki?= Date: Mon, 18 Dec 2023 10:10:21 +0100 Subject: [PATCH 2/3] move severity up --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 1806c97..101734e 100644 --- a/index.js +++ b/index.js @@ -111,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)(), @@ -119,7 +120,6 @@ const logger = winston.createLogger({ format(location)(), format(metaDataFormat)(), format(debugMetaFormat)(), - format(addSeverity)(), formatter ), }); From cd8644852ed354cf92c071c59364d21aa9662dc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antero=20K=C3=A4rki?= Date: Mon, 18 Dec 2023 10:18:04 +0100 Subject: [PATCH 3/3] bump version --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4be3826..fde1024 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "lu-logger", - "version": "7.1.1", + "version": "7.2.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "lu-logger", - "version": "7.1.1", + "version": "7.2.0", "license": "MIT", "dependencies": { "exp-config": "^4.2.0", diff --git a/package.json b/package.json index ad81363..e11e3d3 100644 --- a/package.json +++ b/package.json @@ -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"