From f9c416ccd3ba4aef3d570ee910390425a114e446 Mon Sep 17 00:00:00 2001 From: teatimeguest Date: Sat, 10 Aug 2024 03:02:41 +0900 Subject: [PATCH] perf: relax log formatting limits --- packages/logger/src/log.ts | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/packages/logger/src/log.ts b/packages/logger/src/log.ts index e45b93d..5bc83ae 100644 --- a/packages/logger/src/log.ts +++ b/packages/logger/src/log.ts @@ -40,8 +40,8 @@ export const fatal = createLogMethod('fatal', core.setFailed); const defaultInspectOptions = { depth: 10, compact: false, - maxArrayLength: 10, - maxStringLength: 200, + maxArrayLength: 20, + maxStringLength: 500, } as const satisfies InspectOptions; const logger = { debug, info, warn, fatal } as const; @@ -161,11 +161,15 @@ function* traverseErrors( } function format(fmt: string, ...values: readonly unknown[]): string { - return formatWithOptions( - { colors: hasColors(), ...defaultInspectOptions }, - fmt, - ...values, - ); + const opts: InspectOptions = { + colors: hasColors(), + ...defaultInspectOptions, + }; + if (core.isDebug()) { + opts.maxArrayLength = 100; + opts.maxStringLength = 10_000; + } + return formatWithOptions(opts, fmt, ...values); } function indent(text: string, prefix: string): string {