File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import type { Scope, ScopeData } from '../scope';
66import type { Log , SerializedLog , SerializedLogAttributeValue } from '../types-hoist/log' ;
77import { mergeScopeData } from '../utils/applyScopeDataToEvent' ;
88import { isParameterizedString } from '../utils/is' ;
9- import { debug } from '../utils/logger' ;
9+ import { consoleSandbox , debug } from '../utils/logger' ;
1010import { _getSpanForScope } from '../utils/spanOnScope' ;
1111import { timestampInSeconds } from '../utils/time' ;
1212import { GLOBAL_OBJ } from '../utils/worldwide' ;
@@ -169,7 +169,8 @@ export function _INTERNAL_captureLog(
169169
170170 client . emit ( 'beforeCaptureLog' , processedLog ) ;
171171
172- const log = beforeSendLog ? beforeSendLog ( processedLog ) : processedLog ;
172+ // We need to wrap this in `consoleSandbox` to avoid recursive calls to `beforeSendLog`
173+ const log = beforeSendLog ? consoleSandbox ( ( ) => beforeSendLog ( processedLog ) ) : processedLog ;
173174 if ( ! log ) {
174175 client . recordDroppedEvent ( 'before_send' , 'log_item' , 1 ) ;
175176 DEBUG_BUILD && debug . warn ( 'beforeSendLog returned null, log will not be captured.' ) ;
You can’t perform that action at this time.
0 commit comments