1
1
import { addBreadcrumb , captureException } from '@sentry/core' ;
2
- import type { SeverityLevel } from '@sentry/types' ;
2
+ import type { ConsoleLevel , SeverityLevel } from '@sentry/types' ;
3
3
import { logger as coreLogger } from '@sentry/utils' ;
4
4
5
5
import { DEBUG_BUILD } from '../debug-build' ;
6
6
7
- const CONSOLE_LEVELS = [ 'info' , 'warn' , 'error' , 'log' ] as const ;
7
+ type ReplayConsoleLevels = Extract < ConsoleLevel , 'info' | 'warn' | 'error' | 'log' > ;
8
+ const CONSOLE_LEVELS : readonly ReplayConsoleLevels [ ] = [ 'info' , 'warn' , 'error' , 'log' ] as const ;
8
9
9
10
type LoggerMethod = ( ...args : unknown [ ] ) => void ;
10
11
type LoggerConsoleMethods = Record < 'info' | 'warn' | 'error' | 'log' , LoggerMethod > ;
@@ -15,11 +16,11 @@ interface ReplayLogger extends LoggerConsoleMethods {
15
16
* Calls `logger.info` but saves breadcrumb in the next tick due to race
16
17
* conditions before replay is initialized.
17
18
*/
18
- infoTick ( ... args : unknown [ ] ) : void ;
19
+ infoTick : LoggerMethod ;
19
20
/**
20
21
* Captures exceptions (`Error`) if "capture internal exceptions" is enabled
21
22
*/
22
- exception ( error : unknown ) : void ;
23
+ exception : LoggerMethod ;
23
24
enableCaptureInternalExceptions ( ) : void ;
24
25
disableCaptureInternalExceptions ( ) : void ;
25
26
enableTraceInternals ( ) : void ;
0 commit comments