Files
ChannelTests-TS/test/logger/LoggingLevel.ts
Alexander Zinn 4b672f231f Add command line parsing and configuration management
* Introduced `CommandLine` class for handling command line options and arguments
* Added `TestConfiguration` class to manage application credentials and URIs
* Implemented example usage for generating command line arguments from a configuration object
* Updated `package.json` to include `commander` dependency
* Removed unused `TestRunner` class and created a new `TestRunner` for executing tests with command line options
* Adjusted logging level type to use lowercase values for consistency
2025-08-18 17:54:04 -04:00

61 lines
1.6 KiB
TypeScript

export enum LoggingLevel {
Off = 0,
Fatal = 1,
Error = 2,
Warning = 3,
Info = 4,
Debug = 5,
Trace = 6,
All = 7
}
export type LoggingLevelType = 'off' | 'fatal' | 'error' | 'warning' | 'info' | 'debug' | 'trace' | 'all';
export class LoggingLevelMapping {
public static convertLoggingLevelToLoggingLevelType(level: LoggingLevel): LoggingLevelType {
switch (level) {
case LoggingLevel.Off:
return 'off';
case LoggingLevel.Fatal:
return 'fatal';
case LoggingLevel.Error:
return 'error';
case LoggingLevel.Warning:
return 'warning';
case LoggingLevel.Info:
return 'info';
case LoggingLevel.Debug:
return 'debug';
case LoggingLevel.Trace:
return 'trace';
case LoggingLevel.All:
return 'all';
default:
throw new Error(`[LoggingLevelMapping] Received unknown logging level [${level}]`);
}
}
public static convertLoggingLevelTypeToLoggingLevel(level: LoggingLevelType): LoggingLevel {
switch (level) {
case 'Off':
return LoggingLevel.Off;
case 'Fatal':
return LoggingLevel.Fatal;
case 'Error':
return LoggingLevel.Error;
case 'Warning':
return LoggingLevel.Warning;
case 'Info':
return LoggingLevel.Info;
case 'Debug':
return LoggingLevel.Debug;
case 'Trace':
return LoggingLevel.Trace;
case 'All':
return LoggingLevel.All;
default:
throw new Error(`[LoggingLevelMapping] Received unknown logging level type [${level}]`);
}
}
}