@@ -24,38 +24,41 @@ import { DiagLogger, DiagLogFunction, createNoopDiagLogger } from './logger';
2424 * compatibility/migration issues for any implementation that assume the numeric ordering.
2525 */
2626export enum DiagLogLevel {
27- /** DIagnostic Logging level setting to disable all logging (except and forced logs) */
28- NONE = - 99 ,
27+ /** Diagnostic Logging level setting to disable all logging (except and forced logs) */
28+ NONE = 0 ,
2929
3030 /**
3131 * Identifies a terminal situation that would cause the API to completely fail to initialize,
3232 * if this type of error is logged functionality of the API is not expected to be functional.
3333 */
34- TERMINAL = - 2 ,
34+ TERMINAL = 10 ,
3535
3636 /**
3737 * Identifies a critical error that needs to be addressed, functionality of the component
3838 * that emits this log detail may non-functional.
3939 */
40- CRITICAL = - 1 ,
40+ CRITICAL = 20 ,
4141
4242 /** Identifies an error scenario */
43- ERROR = 0 ,
43+ ERROR = 30 ,
44+
45+ /** Identifies startup and failure (lower) scenarios */
46+ STARTUP = 40 ,
4447
4548 /** Identifies a warning scenario */
46- WARN = 1 ,
49+ WARN = 50 ,
4750
4851 /** General informational log message */
49- INFO = 2 ,
52+ INFO = 60 ,
5053
5154 /** General debug log message */
52- DEBUG = 3 ,
55+ DEBUG = 70 ,
5356
5457 /**
5558 * Detailed trace level logging should only be used for development, should only be set
5659 * in a development environment.
5760 */
58- VERBOSE = 4 ,
61+ VERBOSE = 80 ,
5962
6063 /** Used to set the logging level to include all logging */
6164 ALL = 9999 ,
@@ -79,19 +82,19 @@ const fallbackLoggerFuncMap: { [n: string]: keyof Logger } = {
7982 info : 'info' ,
8083 debug : 'debug' ,
8184 verbose : 'debug' ,
82- forcedInfo : 'info' ,
85+ startupInfo : 'info' ,
8386} ;
8487
8588/** Mapping from DiagLogger function name to logging level. */
86- const levelMap : { n : keyof DiagLogger ; l : DiagLogLevel ; f ?: boolean } [ ] = [
89+ const levelMap : { n : keyof DiagLogger ; l : DiagLogLevel } [ ] = [
8790 { n : 'terminal' , l : DiagLogLevel . TERMINAL } ,
8891 { n : 'critical' , l : DiagLogLevel . CRITICAL } ,
8992 { n : 'error' , l : DiagLogLevel . ERROR } ,
9093 { n : 'warn' , l : DiagLogLevel . WARN } ,
9194 { n : 'info' , l : DiagLogLevel . INFO } ,
9295 { n : 'debug' , l : DiagLogLevel . DEBUG } ,
9396 { n : 'verbose' , l : DiagLogLevel . VERBOSE } ,
94- { n : 'forcedInfo ' , l : DiagLogLevel . INFO , f : true } ,
97+ { n : 'startupInfo ' , l : DiagLogLevel . ERROR } ,
9598] ;
9699
97100/**
@@ -130,10 +133,9 @@ export function createLogLevelDiagLogger(
130133 function _filterFunc (
131134 theLogger : DiagLogger ,
132135 funcName : keyof DiagLogger ,
133- theLevel : DiagLogLevel ,
134- isForced ?: boolean
136+ theLevel : DiagLogLevel
135137 ) : DiagLogFunction {
136- if ( isForced || maxLevel >= theLevel ) {
138+ if ( maxLevel >= theLevel ) {
137139 return function ( ) {
138140 const orgArguments = arguments as unknown ;
139141 const theFunc =
@@ -152,7 +154,7 @@ export function createLogLevelDiagLogger(
152154 const newLogger = { } as DiagLogger ;
153155 for ( let i = 0 ; i < levelMap . length ; i ++ ) {
154156 const name = levelMap [ i ] . n ;
155- newLogger [ name ] = _filterFunc ( logger , name , levelMap [ i ] . l , levelMap [ i ] . f ) ;
157+ newLogger [ name ] = _filterFunc ( logger , name , levelMap [ i ] . l ) ;
156158 }
157159
158160 return newLogger ;
0 commit comments