Skip to content

Commit

Permalink
perf: relax log formatting limits
Browse files Browse the repository at this point in the history
  • Loading branch information
teatimeguest committed Aug 9, 2024
1 parent b2f6f42 commit f9c416c
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions packages/logger/src/log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit f9c416c

Please sign in to comment.