15
15
*/
16
16
17
17
import { DiagAPI } from '../api/diag' ;
18
- import { Logger } from '../common/Logger' ;
19
18
import { DiagLogger , DiagLogFunction , createNoopDiagLogger } from './logger' ;
20
19
21
20
/**
@@ -27,24 +26,9 @@ export enum DiagLogLevel {
27
26
/** Diagnostic Logging level setting to disable all logging (except and forced logs) */
28
27
NONE = 0 ,
29
28
30
- /**
31
- * Identifies a terminal situation that would cause the API to completely fail to initialize,
32
- * if this type of error is logged functionality of the API is not expected to be functional.
33
- */
34
- TERMINAL = 10 ,
35
-
36
- /**
37
- * Identifies a critical error that needs to be addressed, functionality of the component
38
- * that emits this log detail may non-functional.
39
- */
40
- CRITICAL = 20 ,
41
-
42
29
/** Identifies an error scenario */
43
30
ERROR = 30 ,
44
31
45
- /** Identifies startup and failure (lower) scenarios */
46
- STARTUP = 40 ,
47
-
48
32
/** Identifies a warning scenario */
49
33
WARN = 50 ,
50
34
@@ -66,35 +50,17 @@ export enum DiagLogLevel {
66
50
67
51
/**
68
52
* This is equivalent to:
69
- * type LogLevelString = 'NONE' | TERMINAL' | 'CRITICAL' | 'ERROR' | 'WARN' | 'INFO' | 'DEBUG' | 'VERBOSE' | 'ALL';
53
+ * type LogLevelString = 'NONE' | 'ERROR' | 'WARN' | 'INFO' | 'DEBUG' | 'VERBOSE' | 'ALL';
70
54
*/
71
55
export type DiagLogLevelString = keyof typeof DiagLogLevel ;
72
56
73
- /**
74
- * Mapping from DiagLogger function name to Legacy Logger function used if
75
- * the logger instance doesn't have the DiagLogger function
76
- */
77
- const fallbackLoggerFuncMap : { [ n : string ] : keyof Logger } = {
78
- terminal : 'error' ,
79
- critical : 'error' ,
80
- error : 'error' ,
81
- warn : 'warn' ,
82
- info : 'info' ,
83
- debug : 'debug' ,
84
- verbose : 'debug' ,
85
- startupInfo : 'info' ,
86
- } ;
87
-
88
57
/** Mapping from DiagLogger function name to logging level. */
89
58
const levelMap : { n : keyof DiagLogger ; l : DiagLogLevel } [ ] = [
90
- { n : 'terminal' , l : DiagLogLevel . TERMINAL } ,
91
- { n : 'critical' , l : DiagLogLevel . CRITICAL } ,
92
59
{ n : 'error' , l : DiagLogLevel . ERROR } ,
93
60
{ n : 'warn' , l : DiagLogLevel . WARN } ,
94
61
{ n : 'info' , l : DiagLogLevel . INFO } ,
95
62
{ n : 'debug' , l : DiagLogLevel . DEBUG } ,
96
63
{ n : 'verbose' , l : DiagLogLevel . VERBOSE } ,
97
- { n : 'startupInfo' , l : DiagLogLevel . ERROR } ,
98
64
] ;
99
65
100
66
/**
@@ -138,8 +104,7 @@ export function createLogLevelDiagLogger(
138
104
if ( maxLevel >= theLevel ) {
139
105
return function ( ) {
140
106
const orgArguments = arguments as unknown ;
141
- const theFunc =
142
- theLogger [ funcName ] || theLogger [ fallbackLoggerFuncMap [ funcName ] ] ;
107
+ const theFunc = theLogger [ funcName ] ;
143
108
if ( theFunc && typeof theFunc === 'function' ) {
144
109
return theFunc . apply (
145
110
logger ,
0 commit comments