From 8f8d56ada40265636153f752a9b88e32f386a7ce Mon Sep 17 00:00:00 2001 From: Shinwoo PARK Date: Thu, 20 Mar 2025 17:58:47 +0900 Subject: [PATCH] feat: apply createCallLogIdentifyMessage on return log --- src/logged.ts | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/logged.ts b/src/logged.ts index c95a21b..b7adb84 100644 --- a/src/logged.ts +++ b/src/logged.ts @@ -172,8 +172,6 @@ const callLogIdentifyMessageDictionary: Record = { middleware: 'MIDDLEWARE', } -function createCallLogIdentifyMessage(message: 'HIT' | 'RETURNED', type: 'guard' | 'interceptor' | 'middleware' | 'route', key: string, route: string) -function createCallLogIdentifyMessage(message: 'HIT' | 'RETURNED', type: 'function', key: string) function createCallLogIdentifyMessage(message: 'HIT' | 'RETURNED', type: BuildType, key?: string, route?: string) { if (type === 'guard' || type === 'interceptor' || type === 'middleware' || type === 'route') return `${message} ${callLogIdentifyMessageDictionary[type]} ${key} (${route})` @@ -321,11 +319,7 @@ function overrideBuild, R>( : "WITH " + r : ""; - injectedLogger[logged.options.returnLogLevel]( - route - ? `RETURNED HTTP ${route} (${key}) ${resultLogged}` - : `RETURNED ${key} ${resultLogged}` - ); + injectedLogger[logged.options.returnLogLevel](`${createCallLogIdentifyMessage('RETURNED', type, key, route)} ${resultLogged}`); return r; }) } else { @@ -348,11 +342,7 @@ function overrideBuild, R>( : "WITH " + r : ""; - injectedLogger[logged.options.returnLogLevel]( - route - ? `RETURNED HTTP ${route} (${key}) ${resultLogged}` - : `RETURNED ${key} ${resultLogged}` - ); + injectedLogger[logged.options.returnLogLevel](`${createCallLogIdentifyMessage('RETURNED', type, key, route)} ${resultLogged}`); return r; } } else {