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';
7
7
import type { Log , SerializedLog , SerializedLogAttributeValue } from '../types-hoist/log' ;
8
8
import { mergeScopeData } from '../utils/applyScopeDataToEvent' ;
9
9
import { isParameterizedString } from '../utils/is' ;
10
- import { debug } from '../utils/logger' ;
10
+ import { consoleSandbox , debug } from '../utils/logger' ;
11
11
import { _getSpanForScope } from '../utils/spanOnScope' ;
12
12
import { timestampInSeconds } from '../utils/time' ;
13
13
import { SEVERITY_TEXT_TO_SEVERITY_NUMBER } from './constants' ;
@@ -168,7 +168,8 @@ export function _INTERNAL_captureLog(
168
168
169
169
client . emit ( 'beforeCaptureLog' , processedLog ) ;
170
170
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 ;
172
173
if ( ! log ) {
173
174
client . recordDroppedEvent ( 'before_send' , 'log_item' , 1 ) ;
174
175
DEBUG_BUILD && debug . warn ( 'beforeSendLog returned null, log will not be captured.' ) ;
You can’t perform that action at this time.
0 commit comments