Skip to content

Commit

Permalink
Fix attribute merging priority order & mutation
Browse files Browse the repository at this point in the history
  • Loading branch information
okoskine committed Feb 8, 2022
1 parent 5c7ebbe commit 362c3ed
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/logger/src/Logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down Expand Up @@ -362,7 +362,7 @@ class Logger implements ClassThatLogs {
*/
private addToPowertoolLogData(...attributesArray: Array<Partial<PowertoolLogData>>): void {
attributesArray.forEach((attributes: Partial<PowertoolLogData>) => {
this.powertoolLogData = merge(attributes, this.getPowertoolLogData());
merge(this.powertoolLogData, attributes);
});
}

Expand Down

0 comments on commit 362c3ed

Please sign in to comment.