From 7b1e6987572c72ae3654dac144facfa520eb6287 Mon Sep 17 00:00:00 2001 From: Julian <107254512+JulianCissen@users.noreply.github.com> Date: Tue, 3 Sep 2024 09:10:30 +0200 Subject: [PATCH] Fixed an issue where useLevel and customLogLevel Options parameters wouldn't accept CustomLevels. (#346) Co-authored-by: Julian Cissen --- index.d.ts | 4 ++-- index.test-d.ts | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/index.d.ts b/index.d.ts index df22a2a..c7c482d 100644 --- a/index.d.ts +++ b/index.d.ts @@ -25,10 +25,10 @@ export type ReqId = number | string | object; export interface Options extends pino.LoggerOptions { logger?: pino.Logger | undefined; genReqId?: GenReqId | undefined; - useLevel?: pino.LevelWithSilent | undefined; + useLevel?: pino.LevelWithSilent | CustomLevels | undefined; stream?: pino.DestinationStream | undefined; autoLogging?: boolean | AutoLoggingOptions | 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; diff --git a/index.test-d.ts b/index.test-d.ts index 2e8f253..8b10fb1 100644 --- a/index.test-d.ts +++ b/index.test-d.ts @@ -225,3 +225,11 @@ const customLogger = pino({ pinoHttp({ logger: customLogger }).logger.bark("arf arf"); +pinoHttp({ + logger: customLogger, + useLevel: 'bark' +}) +pinoHttp({ + logger: customLogger, + customLogLevel: () => 'bark' +})