Refactor logging level handling and remove example usage
* Updated `CommandLineOptions` and `ConfigurationObject` to use `LoggingLevel` type instead of string for log levels. * Modified `LoggerFactory` to set logging levels using the new `LoggingLevelMapping` methods. * Removed the `example-usage.ts` file as it was no longer needed. * Adjusted `Threshold` class to simplify logging level management.
This commit is contained in:
@@ -1,25 +1,19 @@
|
||||
import PCastAPI from '@techniker-me/pcast-api';
|
||||
import RtmpPush from '@technniker-me/rtmp-push';
|
||||
import LoggerFactory from '../logger/LoggerFactory';
|
||||
import CommandLine from '../config/CommandLine';
|
||||
import { CommandLineOptions } from '../config/CommandLine';
|
||||
|
||||
interface CommandLineOptions {
|
||||
applicationId: string;
|
||||
secret: string;
|
||||
logLevel: string;
|
||||
}
|
||||
|
||||
class TestRunner {
|
||||
export default class TestRunner {
|
||||
private static readonly _logger = LoggerFactory.getLogger('TestRunner');
|
||||
private static readonly _commandLineOptions: CommandLineOptions = CommandLine.parse(process.argv);
|
||||
|
||||
public static main(): void {
|
||||
const testRunner = new TestRunner();
|
||||
testRunner.run();
|
||||
static {
|
||||
TestRunner.run();
|
||||
}
|
||||
|
||||
public run(): void {
|
||||
console.log(TestRunner._commandLineOptions);
|
||||
public static run(): void {
|
||||
LoggerFactory.setLoggingLevel(TestRunner._commandLineOptions.logLevel);
|
||||
|
||||
TestRunner._logger.info('TestRunner started');
|
||||
TestRunner._logger.info(JSON.stringify(TestRunner._commandLineOptions, null, 2));
|
||||
}
|
||||
}
|
||||
|
||||
TestRunner.main();
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user