From da02c071096e7c1ba07bc90b9e1b06a77829357e Mon Sep 17 00:00:00 2001 From: Audrius Vaitonis Date: Tue, 25 Jul 2023 13:05:45 +0100 Subject: [PATCH] feat(APIM-344): fix 2 PR feedback items, change comment and var type --- src/helpers/redact-strings-in-log-args.helper.ts | 2 +- src/main.module.ts | 2 +- src/main.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/helpers/redact-strings-in-log-args.helper.ts b/src/helpers/redact-strings-in-log-args.helper.ts index 345a08c2..d50e76c8 100644 --- a/src/helpers/redact-strings-in-log-args.helper.ts +++ b/src/helpers/redact-strings-in-log-args.helper.ts @@ -5,7 +5,7 @@ export const redactStringsInLogArgs = ( redactLogs: boolean, redactPaths: string[], redactStrings: { searchValue: string | RegExp; replaceValue: string }[], - args: any, + args: any[], ): any => { if (!redactLogs) { return args; diff --git a/src/main.module.ts b/src/main.module.ts index a86aae59..6fb41e02 100644 --- a/src/main.module.ts +++ b/src/main.module.ts @@ -33,7 +33,7 @@ import { LoggingInterceptor } from './logging/logging-interceptor.helper'; }, }, hooks: { - logMethod(inputArgs: any, method) { + logMethod(inputArgs: any[], method) { return method.apply(this, redactStringsInLogArgs(config.get('app.redactLogs'), REDACT_STRING_PATHS, REDACT_STRINGS, inputArgs)); }, }, diff --git a/src/main.ts b/src/main.ts index bf63d572..bbace709 100644 --- a/src/main.ts +++ b/src/main.ts @@ -7,7 +7,7 @@ import { REDACT_STRINGS } from './constants'; import { ConsoleLoggerWithRedact } from './logging/console-logger-with-redact'; const main = async () => { - // If REDACT_LOGS is true use ConsoleLoggerWithRedact. ConsoleLoggerWithRedact is used just if `NestFactory.create` is fails completely. + // If REDACT_LOGS is true use ConsoleLoggerWithRedact. ConsoleLoggerWithRedact is used just if `NestFactory.create` fails completely. // If `NestFactory.create` doesn't fail completely, then buffered logs are passed to PinoLogger. NestLogger and ConsoleLoggerWithRedact are not used. const logger = process.env.REDACT_LOGS !== 'false' ? new ConsoleLoggerWithRedact(REDACT_STRINGS) : new NestLogger(); const nestApp: NestApplication = await NestFactory.create(MainModule, { logger, bufferLogs: true });