File tree Expand file tree Collapse file tree 2 files changed +18
-14
lines changed
Flow.Launcher.Infrastructure/Logger Expand file tree Collapse file tree 2 files changed +18
-14
lines changed Original file line number Diff line number Diff line change @@ -63,16 +63,28 @@ static Log()
63
63
LogManager . Configuration = configuration ;
64
64
}
65
65
66
- public static void UseDebugLogLevel ( )
66
+ public static void SetLogLevel ( LOGLEVEL level )
67
+ {
68
+ switch ( level )
69
+ {
70
+ case LOGLEVEL . DEBUG :
71
+ UseDebugLogLevel ( ) ;
72
+ break ;
73
+ default :
74
+ UseInfoLogLevel ( ) ;
75
+ break ;
76
+ }
77
+ Info ( nameof ( Logger ) , $ "Using log level: { level } .") ;
78
+ }
79
+
80
+ private static void UseDebugLogLevel ( )
67
81
{
68
82
LogManager . Configuration . FindRuleByName ( "file" ) . SetLoggingLevels ( LogLevel . Debug , LogLevel . Fatal ) ;
69
- Info ( nameof ( Logger ) , "Using log level: DEBUG." ) ;
70
83
}
71
84
72
- public static void UseInfoLogLevel ( )
85
+ private static void UseInfoLogLevel ( )
73
86
{
74
87
LogManager . Configuration . FindRuleByName ( "file" ) . SetLoggingLevels ( LogLevel . Info , LogLevel . Fatal ) ;
75
- Info ( nameof ( Logger ) , "Using log level: INFO." ) ;
76
88
}
77
89
78
90
private static void LogFaultyFormat ( string message )
Original file line number Diff line number Diff line change @@ -112,6 +112,8 @@ private async void OnStartupAsync(object sender, StartupEventArgs e)
112
112
{
113
113
await Stopwatch . NormalAsync ( "|App.OnStartup|Startup cost" , async ( ) =>
114
114
{
115
+ Log . SetLogLevel ( _settings . LogLevel ) ;
116
+
115
117
Ioc . Default . GetRequiredService < Portable > ( ) . PreStartCleanUpAfterPortabilityUpdate ( ) ;
116
118
117
119
Log . Info ( "|App.OnStartup|Begin Flow Launcher startup ----------------------------------------------------" ) ;
@@ -122,16 +124,6 @@ await Stopwatch.NormalAsync("|App.OnStartup|Startup cost", async () =>
122
124
123
125
var imageLoadertask = ImageLoader . InitializeAsync ( ) ;
124
126
125
- switch ( _settings . LogLevel )
126
- {
127
- case LOGLEVEL . DEBUG :
128
- Log . UseDebugLogLevel ( ) ;
129
- break ;
130
- default :
131
- Log . UseInfoLogLevel ( ) ;
132
- break ;
133
- }
134
-
135
127
AbstractPluginEnvironment . PreStartPluginExecutablePathUpdate ( _settings ) ;
136
128
137
129
// TODO: Clean InternationalizationManager.Instance and InternationalizationManager.Instance.GetTranslation in future
You can’t perform that action at this time.
0 commit comments