Skip to content

Commit 4610951

Browse files
committed
♻️ fixed rest arguments in logging
1 parent c1074c8 commit 4610951

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/util/logger.util.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,18 +62,19 @@ const logger = (
6262
`[${anonymizeKey(apiKey)}]`,
6363
`[${source}]`,
6464
message,
65-
args
65+
...args
6666
)
6767
);
6868
} else {
69-
logFn(constructLogMessage(`[${source}]`, message, args));
69+
logFn(constructLogMessage(`[${source}]`, message, ...args));
7070
}
7171
};
7272

7373
const constructLogMessage = (...args: unknown[]): string =>
7474
`${args
7575
.flat()
76-
.map((item: unknown) =>
77-
typeof item !== "string" ? JSON.stringify(item) : item
78-
)
76+
.map((item: unknown) => {
77+
if (Array.isArray(item) && item.length == 0) return;
78+
return typeof item !== "string" ? JSON.stringify(item) : item;
79+
})
7980
.join(" ")}`;

0 commit comments

Comments
 (0)