File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 1
1
/* eslint-disable @typescript-eslint/no-explicit-any */
2
2
import { WrappedFunction } from '@sentry/types' ;
3
3
4
+ import { isDebugBuild } from './env' ;
4
5
import { getGlobalObject } from './global' ;
5
6
6
7
// TODO: Implement different loggers for different environments
@@ -104,8 +105,13 @@ class Logger {
104
105
}
105
106
}
106
107
107
- // Ensure we only have a single logger instance, even if multiple versions of @sentry/utils are being used
108
- global . __SENTRY__ = global . __SENTRY__ || { } ;
109
- const logger = ( global . __SENTRY__ . logger as Logger ) || ( global . __SENTRY__ . logger = new Logger ( ) ) ;
108
+ const sentryGlobal = global . __SENTRY__ || { } ;
109
+ const logger = ( sentryGlobal . logger as Logger ) || new Logger ( ) ;
110
+
111
+ if ( isDebugBuild ( ) ) {
112
+ // Ensure we only have a single logger instance, even if multiple versions of @sentry/utils are being used
113
+ sentryGlobal . logger = logger ;
114
+ global . __SENTRY__ = sentryGlobal ;
115
+ }
110
116
111
117
export { logger } ;
You can’t perform that action at this time.
0 commit comments