Skip to content

Commit

Permalink
Merge pull request #18 from odpf/fix_log_format
Browse files Browse the repository at this point in the history
fix: logs for http request
  • Loading branch information
pyadav authored Aug 10, 2021
2 parents 9e2b645 + b2a9fc6 commit 7f5a483
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 7f5a483

Please sign in to comment.