Skip to content

Commit

Permalink
Fixed an issue where useLevel and customLogLevel Options parameters w…
Browse files Browse the repository at this point in the history
…ouldn't accept CustomLevels. (#346)

Co-authored-by: Julian Cissen <[email protected]>
  • Loading branch information
JulianCissen and Juulloo committed Sep 3, 2024
1 parent a4b581a commit 7b1e698
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ export type ReqId = number | string | object;
export interface Options<IM = IncomingMessage, SR = ServerResponse, CustomLevels extends string = never> extends pino.LoggerOptions {
logger?: pino.Logger<CustomLevels> | undefined;
genReqId?: GenReqId<IM, SR> | undefined;
useLevel?: pino.LevelWithSilent | undefined;
useLevel?: pino.LevelWithSilent | CustomLevels | undefined;
stream?: pino.DestinationStream | undefined;
autoLogging?: boolean | AutoLoggingOptions<IM> | undefined;
customLogLevel?: ((req: IM, res: SR, error?: Error) => pino.LevelWithSilent) | undefined;
customLogLevel?: ((req: IM, res: SR, error?: Error) => pino.LevelWithSilent | CustomLevels) | undefined;
customReceivedMessage?: ((req: IM, res: SR) => string) | undefined;
customSuccessMessage?: ((req: IM, res: SR, responseTime: number) => string) | undefined;
customErrorMessage?: ((req: IM, res: SR, error: Error) => string) | undefined;
Expand Down
8 changes: 8 additions & 0 deletions index.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,3 +225,11 @@ const customLogger = pino({
pinoHttp({
logger: customLogger
}).logger.bark("arf arf");
pinoHttp({
logger: customLogger,
useLevel: 'bark'
})
pinoHttp({
logger: customLogger,
customLogLevel: () => 'bark'
})

0 comments on commit 7b1e698

Please sign in to comment.