Skip to content

Commit

Permalink
Fix customSuccessMessage ts definition (#270)
Browse files Browse the repository at this point in the history
* fix customSuccessMessage ts definition

* add tsd for customSuccessMessage
  • Loading branch information
robmcguinness authored Jan 30, 2023
1 parent 81bb437 commit 62c8e7d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions import.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ const { pinoHttp: pinoHttpCjsNamed } = require('.');
const logger = pino();

expectType<HttpLogger>(pinoHttp({ logger }));
expectType<HttpLogger>(pinoHttp({
customSuccessMessage(req, res, responseTime) {
return `${responseTime}`
}
}));
expectType<HttpLogger>(pinoHttpNamed());
expectType<HttpLogger>(pinoHttpStar.default());
expectType<HttpLogger>(pinoHttpStar.pinoHttp());
Expand Down
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export interface Options extends pino.LoggerOptions {
autoLogging?: boolean | AutoLoggingOptions | undefined;
customLogLevel?: ((req: IncomingMessage, res: ServerResponse, error?: Error) => pino.LevelWithSilent) | undefined;
customReceivedMessage?: ((req: IncomingMessage, res: ServerResponse) => string) | undefined;
customSuccessMessage?: ((req: IncomingMessage, res: ServerResponse) => string) | undefined;
customSuccessMessage?: ((req: IncomingMessage, res: ServerResponse, responseTime: number) => string) | undefined;
customErrorMessage?: ((req: IncomingMessage, res: ServerResponse, error: Error) => string) | undefined;
customReceivedObject?: ((req: IncomingMessage, res: ServerResponse, val?: any) => any) | undefined;
customSuccessObject?: ((req: IncomingMessage, res: ServerResponse, val: any) => any) | undefined;
Expand Down

0 comments on commit 62c8e7d

Please sign in to comment.