From 3ad70200a662a93ea8809b362eb928321c5b5383 Mon Sep 17 00:00:00 2001 From: Booster2ooo Date: Fri, 19 Jul 2019 14:07:00 +0200 Subject: [PATCH 1/2] Splat original message and parametters (https://github.com/winstonjs/logform/issues/94) Added the possibility to keep track of the message and parameters before formatting/interpolation --- splat.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/splat.js b/splat.js index 08ff6f7..dde3566 100644 --- a/splat.js +++ b/splat.js @@ -69,6 +69,12 @@ class Splatter { } info.message = util.format(msg, ...splat); + if (this.options.source && this.options.arguments) { + const sourceMeta = {}; + sourceMeta[this.options.source] = msg; + sourceMeta[this.options.arguments] = splat; + Object.assign(info, sourceMeta); + } return info; } From 453b6aa51152efb7e3fab5f230cfaf341baec857 Mon Sep 17 00:00:00 2001 From: Booster2ooo Date: Mon, 22 Jul 2019 10:19:53 +0200 Subject: [PATCH 2/2] Updated splat.js Updated splat, avoid 'this.options' from being undefined --- splat.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/splat.js b/splat.js index dde3566..3c21a3b 100644 --- a/splat.js +++ b/splat.js @@ -19,7 +19,7 @@ const escapedPercent = /%%/g; class Splatter { constructor(opts) { - this.options = opts; + this.options = opts || {}; } /**