Skip to content

Commit

Permalink
change setBindings to clearBindings (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
maou-shonen authored Oct 20, 2024
1 parent 6ee75f1 commit 3e9595b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/logger.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ describe("logger", () => {
expect(logger.bindings()).toStrictEqual({ foo: "bar" });
});

it("set bindings", () => {
logger.setBindings({ foo: "bar" });
it("clear bindings", () => {
logger.assign({ foo: "bar" });
logger.clearBindings();
logger.info("foo");
expect(logs[0]).toStrictEqual({
msg: "foo",
level: 30,
foo: "bar",
});
});

Expand Down
6 changes: 3 additions & 3 deletions src/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ export class PinoLogger {
}

/**
* Set bindings to http log context
* Clear bindings from http log context
*/
setBindings(bindings: pino.Bindings) {
this._logger = this.#rootLogger.child(bindings);
clearBindings() {
this._logger = this.#rootLogger.child({});
}

/**
Expand Down

0 comments on commit 3e9595b

Please sign in to comment.