File tree 1 file changed +14
-3
lines changed
1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -34,10 +34,20 @@ private class AppSettings
34
34
}
35
35
36
36
// Entry point of the application
37
- private static void Main ( )
37
+ private static void Main ( string [ ] args )
38
38
{
39
- // Setting the level of logging for the application
40
- const LogLevel logLevel = LogLevel . None ;
39
+ LogLevel logLevel ;
40
+
41
+ // Parse the log level from the command line arguments
42
+ if ( args . Length > 0 && Enum . TryParse < LogLevel > ( args [ 0 ] , true , out var parsedLogLevel ) )
43
+ {
44
+ logLevel = parsedLogLevel ;
45
+ }
46
+ else
47
+ {
48
+ // If no valid log level provided, default to LogLevel.None
49
+ logLevel = LogLevel . None ;
50
+ }
41
51
42
52
// Load the configuration from JSON
43
53
var appSettingsList = JsonConvert . DeserializeObject < List < AppSettings > > ( File . ReadAllText ( "app-config.json" ) ) ;
@@ -83,6 +93,7 @@ private static void Main()
83
93
wiresock . Dispose ( ) ;
84
94
}
85
95
96
+
86
97
// Method to handle logging events
87
98
private static void LogPrinter ( object sender , LogEventArgs e )
88
99
{
You can’t perform that action at this time.
0 commit comments