Skip to content

Commit

Permalink
Add missing type definitions for custom message properties (#166)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathansamines committed Jun 7, 2022
1 parent 342f56d commit d313bdb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ declare namespace HapiPino {
logRouteTags?: boolean | undefined;
logRequestStart?: boolean | ((req: Request) => boolean) | undefined;
logRequestComplete?: boolean | ((req: Request) => boolean) | undefined;
customRequestStartMessage?: ((req: Request) => string) | undefined;
customRequestCompleteMessage?: ((req: Request, responseTime: number) => string) | undefined;
customRequestErrorMessage?: ((req: Request, error: Error) => string) | undefined;
tags?: { [key in pino.Level]?: string } | undefined;
stream?: NodeJS.WriteStream | undefined;
allTags?: pino.Level | undefined;
Expand Down
3 changes: 3 additions & 0 deletions index.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ const options: HapiPino.Options = {
getChildBindings: (req: Request) => ({
'x-request-id': req.headers['x-request-id'],
}),
customRequestStartMessage: (req: Request) => `request start ${req.path}`,
customRequestCompleteMessage: (req: Request, responseTime: number) => `request complete ${req.path} in ${responseTime}ms`,
customRequestErrorMessage: (req: Request, error: Error) => `request failed ${req.path} with error ${error.message}`,
instance: pinoLogger,
logEvents: false,
mergeHapiLogData: false,
Expand Down

0 comments on commit d313bdb

Please sign in to comment.