From b2a9fc6bf94ec30cc865c24be3e1ba86f6f338c0 Mon Sep 17 00:00:00 2001 From: Rishabh Mishra Date: Mon, 9 Aug 2021 18:58:06 +0530 Subject: [PATCH] fix: logs for http request --- src/plugin/logging.ts | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/plugin/logging.ts b/src/plugin/logging.ts index 94265754a..d892e18e3 100644 --- a/src/plugin/logging.ts +++ b/src/plugin/logging.ts @@ -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) { @@ -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]' } } };