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 @@ -7,7 +7,7 @@ import type { Scope, ScopeData } from '../scope';
77import type { Log , SerializedLog , SerializedLogAttributeValue } from '../types-hoist/log' ;
88import { mergeScopeData } from '../utils/applyScopeDataToEvent' ;
99import { isParameterizedString } from '../utils/is' ;
10- import { debug } from '../utils/logger' ;
10+ import { consoleSandbox , debug } from '../utils/logger' ;
1111import { _getSpanForScope } from '../utils/spanOnScope' ;
1212import { timestampInSeconds } from '../utils/time' ;
1313import { SEVERITY_TEXT_TO_SEVERITY_NUMBER } from './constants' ;
@@ -168,7 +168,8 @@ export function _INTERNAL_captureLog(
168168
169169 client . emit ( 'beforeCaptureLog' , processedLog ) ;
170170
171- const log = beforeSendLog ? beforeSendLog ( processedLog ) : processedLog ;
171+ // We need to wrap this in `consoleSandbox` to avoid recursive calls to `beforeSendLog`
172+ const log = beforeSendLog ? consoleSandbox ( ( ) => beforeSendLog ( processedLog ) ) : processedLog ;
172173 if ( ! log ) {
173174 client . recordDroppedEvent ( 'before_send' , 'log_item' , 1 ) ;
174175 DEBUG_BUILD && debug . warn ( 'beforeSendLog returned null, log will not be captured.' ) ;
You can’t perform that action at this time.
0 commit comments