Skip to content

Commit

Permalink
Use better param name
Browse files Browse the repository at this point in the history
  • Loading branch information
LoicPoullain committed Aug 22, 2024
1 parent d9a79bd commit a249f41
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/blog/version-5.0-release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Version 5.0 of [Foal](https://foalts.org/) is out!
## Logging
- The `Logger.addLogContext(key, value)` method now accepts a record as argument: `Logger.addLogContext(params)`. This makes the function's signature more consistent with other logging methods (`info`, `warn`, etc.) and allows multiple parameters to be passed at once.
- The `Logger.addLogContext(key, value)` method now accepts a record as parameter: `Logger.addLogContext(context)`. This makes the function's signature more consistent with other logging methods (`info`, `warn`, etc.) and allows multiple keys/values to be passed at once.
## Removal of deprecated components
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/core/logging/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ export class Logger {
this.asyncLocalStorage.run({}, callback);
}

addLogContext(params: Record<string, any>): void {
addLogContext(context: Record<string, any>): void {
const store = this.asyncLocalStorage.getStore();
if (!store) {
this.log('warn', 'Impossible to add log context information. The logger context has not been initialized.');
return;
}
Object.assign(store, params);
Object.assign(store, context);
}

log(
Expand Down

0 comments on commit a249f41

Please sign in to comment.