We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 05c60fc commit cb2cddaCopy full SHA for cb2cdda
src/util/logger.util.ts
@@ -58,14 +58,22 @@ const logger = (
58
// eslint-disable-next-line no-console
59
const anonymizedApiKey = apiKey ? anonymizeKey(apiKey) : undefined;
60
61
- logFn(
62
- constructLogMessage(
63
- anonymizedApiKey ? `[${anonymizedApiKey}]` : undefined,
64
- `[${source}]`,
65
- message
66
- ),
67
- ...args
+ const formatedMessage = constructLogMessage(
+ anonymizedApiKey ? `[${anonymizedApiKey}]` : undefined,
+ `[${source}]`,
+ message
68
);
+
+ if (process.env.NODE_ENV == "development") {
+ logFn(formatedMessage, ...args);
69
+ } else {
70
+ logFn(
71
+ JSON.stringify({
72
+ message: formatedMessage,
73
+ data: args,
74
+ })
75
+ );
76
+ }
77
};
78
79
const constructLogMessage = (...args: unknown[]): string =>
0 commit comments