File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import type { Scope, ScopeData } from '../scope';
6
6
import type { Log , SerializedLog , SerializedLogAttributeValue } from '../types-hoist/log' ;
7
7
import { mergeScopeData } from '../utils/applyScopeDataToEvent' ;
8
8
import { isParameterizedString } from '../utils/is' ;
9
- import { debug } from '../utils/logger' ;
9
+ import { consoleSandbox , debug } from '../utils/logger' ;
10
10
import { _getSpanForScope } from '../utils/spanOnScope' ;
11
11
import { timestampInSeconds } from '../utils/time' ;
12
12
import { GLOBAL_OBJ } from '../utils/worldwide' ;
@@ -169,7 +169,8 @@ export function _INTERNAL_captureLog(
169
169
170
170
client . emit ( 'beforeCaptureLog' , processedLog ) ;
171
171
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 ;
173
174
if ( ! log ) {
174
175
client . recordDroppedEvent ( 'before_send' , 'log_item' , 1 ) ;
175
176
DEBUG_BUILD && debug . warn ( 'beforeSendLog returned null, log will not be captured.' ) ;
You can’t perform that action at this time.
0 commit comments