Skip to content

Commit

Permalink
fix: logs for http request
Browse files Browse the repository at this point in the history
  • Loading branch information
rsbh committed Aug 9, 2021
1 parent 9e2b645 commit b2a9fc6
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/plugin/logging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,9 @@ const config = {
options: {
colored: true,
hapiPino: {
logQueryParams: true,
ignorePaths: ['/ping']
},
tokens: {
path: (data: any) => {
const { url } = data.req;
return `${url.pathname}${url.search}${url.hash}`;
}
},
preformatter: (data: any) => {
const statusCode = R.pathOr(null, ['res', 'statusCode'], data);
if (statusCode && statusCode < 400) {
Expand All @@ -29,11 +24,11 @@ const config = {
log: ':time[iso] [:level] :tags :message',
request: ':time[iso] [:level] :message',
response:
':time[iso] [:level] :method :path :status :payload (:responseTime ms)',
':time[iso] [:level] :method :url :get[queryParams] :status :payload (:responseTime ms)',
uncaught:
':time[iso] [:level] :method :path :payload :error[source] :error[stack]',
':time[iso] [:level] :method :url :get[queryParams] :payload :error[source] :error[stack]',
'request-error':
':time[iso] [:level] :method :path :payload :error[message] :error[stack]'
':time[iso] [:level] :method :url :get[queryParams] :payload :error[message] :error[stack]'
}
}
};
Expand Down

0 comments on commit b2a9fc6

Please sign in to comment.