Skip to content

Commit

Permalink
fix: allow overriding level in log.*.complete
Browse files Browse the repository at this point in the history
  • Loading branch information
noomorph committed Jul 3, 2024
1 parent f7a5254 commit 02696c1
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/decorator/Bunyamin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,16 @@ export class Bunyamin<Logger extends BunyanLikeLogger = BunyanLikeLogger> {
const endContext = {
...this.#transformContext(customContext),
ph: 'E',
tid: fields.tid,
} as ResolvedFields;

if (fields.tid !== undefined) {
endContext.tid = fields.tid;
}

if (fields.level !== undefined) {
endContext.level = fields.level;
}

this.#endInternal(level, endContext, []);
};

Expand Down Expand Up @@ -266,6 +273,15 @@ type ResolvedFields = UserFields & {
cat?: string;
ph?: 'B' | 'E';
tid?: ThreadID;
/**
* 10 - trace
* 20 - debug
* 30 - info
* 40 - warn
* 50 - error
* 60 - fatal
*/
level?: number;
};

type SharedBunyaminConfig<Logger extends BunyanLikeLogger> = BunyaminConfig<Logger> & {
Expand Down

0 comments on commit 02696c1

Please sign in to comment.