|
| 1 | +import { addBreadcrumb } from '@sentry/core'; |
1 | 2 | import { Event } from '@sentry/types';
|
2 | 3 |
|
3 | 4 | import { REPLAY_EVENT_NAME, UNABLE_TO_SEND_REPLAY } from '../constants';
|
4 | 5 | import type { ReplayContainer } from '../types';
|
5 |
| -import { addInternalBreadcrumb } from '../util/addInternalBreadcrumb'; |
6 | 6 |
|
7 | 7 | /**
|
8 | 8 | * Returns a listener to be added to `addGlobalEventProcessor(listener)`.
|
@@ -39,11 +39,13 @@ export function handleGlobalEventListener(replay: ReplayContainer): (event: Even
|
39 | 39 | }
|
40 | 40 |
|
41 | 41 | const exc = event.exception?.values?.[0];
|
42 |
| - addInternalBreadcrumb({ |
43 |
| - message: `Tagging event (${event.event_id}) - ${event.message} - ${exc?.type || 'Unknown'}: ${ |
44 |
| - exc?.value || 'n/a' |
45 |
| - }`, |
46 |
| - }); |
| 42 | + if (__DEBUG_BUILD__ && replay.getOptions()._experiments?.traceInternals) { |
| 43 | + addInternalBreadcrumb({ |
| 44 | + message: `Tagging event (${event.event_id}) - ${event.message} - ${exc?.type || 'Unknown'}: ${ |
| 45 | + exc?.value || 'n/a' |
| 46 | + }`, |
| 47 | + }); |
| 48 | + } |
47 | 49 |
|
48 | 50 | // Need to be very careful that this does not cause an infinite loop
|
49 | 51 | if (
|
@@ -72,3 +74,14 @@ export function handleGlobalEventListener(replay: ReplayContainer): (event: Even
|
72 | 74 | return event;
|
73 | 75 | };
|
74 | 76 | }
|
| 77 | + |
| 78 | +function addInternalBreadcrumb(arg: Parameters<typeof addBreadcrumb>[0]): void { |
| 79 | + const { category, level, message, ...rest } = arg; |
| 80 | + |
| 81 | + addBreadcrumb({ |
| 82 | + category: category || 'console', |
| 83 | + level: level || 'debug', |
| 84 | + message: `[debug]: ${message}`, |
| 85 | + ...rest, |
| 86 | + }); |
| 87 | +} |
0 commit comments