@@ -65,30 +65,30 @@ public static async Task Entry(string[] args, Action initAction, Action<LogOptio
65
65
LogOptions . Default . LogType = serverType ;
66
66
LogOptions . Default . GrafanaLokiLabels = new Dictionary < string , string > ( ) ;
67
67
68
- // 将LauncherOptions的所有属性添加到标签中
69
- var properties = typeof ( LauncherOptions ) . GetProperties ( ) ;
70
- foreach ( var property in properties )
68
+ if ( launcherOptions != null )
71
69
{
72
- var grafanaLokiLabelTagAttribute = property . GetCustomAttribute < GrafanaLokiLabelTagAttribute > ( ) ;
73
- if ( grafanaLokiLabelTagAttribute == null )
70
+ // 将LauncherOptions的所有属性添加到标签中
71
+ var properties = typeof ( LauncherOptions ) . GetProperties ( ) ;
72
+ foreach ( var property in properties )
74
73
{
75
- continue ;
76
- }
74
+ var grafanaLokiLabelTagAttribute = property . GetCustomAttribute < GrafanaLokiLabelTagAttribute > ( ) ;
75
+ if ( grafanaLokiLabelTagAttribute == null )
76
+ {
77
+ continue ;
78
+ }
77
79
78
- var value = property . GetValue ( launcherOptions ) ? . ToString ( ) ;
79
- if ( string . IsNullOrEmpty ( value ) )
80
- {
81
- continue ;
82
- }
80
+ var value = property . GetValue ( launcherOptions ) ? . ToString ( ) ;
81
+ if ( string . IsNullOrEmpty ( value ) )
82
+ {
83
+ continue ;
84
+ }
83
85
84
- if ( ! LogOptions . Default . GrafanaLokiLabels . TryAdd ( property . Name , value ) )
85
- {
86
- LogHelper . WarnConsole ( $ "Grafana Loki 标签 { property . Name } 已存在,将被忽略") ;
86
+ if ( ! LogOptions . Default . GrafanaLokiLabels . TryAdd ( property . Name , value ) )
87
+ {
88
+ LogHelper . WarnConsole ( $ "Grafana Loki 标签 { property . Name } 已存在,将被忽略") ;
89
+ }
87
90
}
88
- }
89
91
90
- if ( launcherOptions != null )
91
- {
92
92
// 设置日志配置信息
93
93
LogOptions . Default . IsConsole = launcherOptions . LogIsConsole ;
94
94
LogOptions . Default . IsGrafanaLoki = launcherOptions . LogIsGrafanaLoki ;
0 commit comments