From 362c3edc2bc4ec8db7053eb2420e0a3d2d11ff48 Mon Sep 17 00:00:00 2001 From: Onni Koskinen Date: Sun, 6 Feb 2022 10:32:59 +0200 Subject: [PATCH] Fix attribute merging priority order & mutation --- packages/logger/src/Logger.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/logger/src/Logger.ts b/packages/logger/src/Logger.ts index b018543a27..bba8ff3b51 100644 --- a/packages/logger/src/Logger.ts +++ b/packages/logger/src/Logger.ts @@ -174,7 +174,7 @@ class Logger implements ClassThatLogs { * @returns {void} */ public addPersistentLogAttributes(attributes?: LogAttributes): void { - this.persistentLogAttributes = merge(attributes, this.getPersistentLogAttributes()); + merge(this.persistentLogAttributes, attributes); } /** @@ -362,7 +362,7 @@ class Logger implements ClassThatLogs { */ private addToPowertoolLogData(...attributesArray: Array>): void { attributesArray.forEach((attributes: Partial) => { - this.powertoolLogData = merge(attributes, this.getPowertoolLogData()); + merge(this.powertoolLogData, attributes); }); }