File tree 2 files changed +8
-31
lines changed
integration-node-breadcrumbs/src 2 files changed +8
-31
lines changed Original file line number Diff line number Diff line change @@ -27,24 +27,7 @@ export class ConsoleBreadcrumbs implements Integration {
27
27
*/
28
28
function createConsoleWrapper ( level : string , client : ClientLike ) : ( originalConsoleMethod : ( ) => void ) => void {
29
29
return function consoleWrapper ( originalConsoleMethod : ( ) => void ) : ( ) => void {
30
- let sentryLevel : Severity ;
31
-
32
- switch ( level ) {
33
- case 'debug' :
34
- sentryLevel = Severity . Debug ;
35
- break ;
36
- case 'error' :
37
- sentryLevel = Severity . Error ;
38
- break ;
39
- case 'info' :
40
- sentryLevel = Severity . Info ;
41
- break ;
42
- case 'warn' :
43
- sentryLevel = Severity . Warning ;
44
- break ;
45
- default :
46
- sentryLevel = Severity . Log ;
47
- }
30
+ const sentryLevel = Severity . fromString ( level ) ;
48
31
49
32
return function ( this : typeof console , ...args : unknown [ ] ) : void {
50
33
client . getScope ( ) . addBreadcrumb (
Original file line number Diff line number Diff line change @@ -3,10 +3,8 @@ export enum Severity {
3
3
Fatal = 'fatal' ,
4
4
Error = 'error' ,
5
5
Warning = 'warning' ,
6
- Log = 'log' ,
7
6
Info = 'info' ,
8
7
Debug = 'debug' ,
9
- Critical = 'critical' ,
10
8
}
11
9
12
10
// eslint-disable-next-line @typescript-eslint/no-namespace, import/export
@@ -19,22 +17,18 @@ export namespace Severity {
19
17
*/
20
18
export function fromString ( level : string ) : Severity {
21
19
switch ( level ) {
22
- case 'debug' :
23
- return Severity . Debug ;
24
- case 'info' :
25
- return Severity . Info ;
20
+ case 'fatal' :
21
+ return Severity . Fatal ;
26
22
case 'warn' :
27
23
case 'warning' :
28
24
return Severity . Warning ;
29
- case 'error' :
30
- return Severity . Error ;
31
- case 'fatal' :
32
- return Severity . Fatal ;
33
- case 'critical' :
34
- return Severity . Critical ;
35
25
case 'log' :
26
+ case 'info' :
27
+ return Severity . Info ;
28
+ case 'debug' :
29
+ return Severity . Debug ;
36
30
default :
37
- return Severity . Log ;
31
+ return Severity . Error ;
38
32
}
39
33
}
40
34
}
You can’t perform that action at this time.
0 commit comments