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 724bea8 commit d165481Copy full SHA for d165481
packages/gitbook/src/lib/tracing.ts
@@ -28,16 +28,21 @@ export async function trace<T>(
28
};
29
30
const start = now();
31
+ let failed = false;
32
try {
33
return await fn(span);
34
} catch (error) {
35
span.setAttribute('error', true);
36
+ failed = true;
37
throw error;
38
} finally {
- if (process.env.SILENT !== 'true') {
39
+ if (process.env.SILENT !== 'true' && process.env.NODE_ENV !== 'development') {
40
const end = now();
41
// biome-ignore lint/suspicious/noConsole: we want to log performance data
- console.log(`trace ${completeName} ${end - start}ms`, attributes);
42
+ console.log(
43
+ `trace ${completeName} ${failed ? 'failed' : 'succeeded'} in ${end - start}ms`,
44
+ attributes
45
+ );
46
}
47
48
0 commit comments