Skip to content

Commit 0ef5ffe

Browse files
committed
feat(日志): 添加根据启动选项设置日志标签名的功能
当TagName不为空时使用TagName作为日志标签名,否则依次尝试使用Note、Label和Description作为日志标签名
1 parent 35ea6ba commit 0ef5ffe

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

GameFrameX.StartUp/GameApp.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,22 @@ public static async Task Entry(string[] args, Action initAction, Action<LogOptio
132132
}
133133

134134
LogOptions.Default.LogType = logTypeParts.Count > 0 ? string.Join("_", logTypeParts) : null;
135+
if (launcherOptions.TagName.IsNotNullOrWhiteSpace())
136+
{
137+
LogOptions.Default.LogTagName = launcherOptions.TagName;
138+
}
139+
else if (launcherOptions.Note.IsNotNullOrWhiteSpace())
140+
{
141+
LogOptions.Default.LogTagName = launcherOptions.Note;
142+
}
143+
else if (launcherOptions.Label.IsNotNullOrWhiteSpace())
144+
{
145+
LogOptions.Default.LogTagName = launcherOptions.Label;
146+
}
147+
else if (launcherOptions.Description.IsNotNullOrWhiteSpace())
148+
{
149+
LogOptions.Default.LogTagName = launcherOptions.Description;
150+
}
135151
}
136152

137153
logConfiguration?.Invoke(LogOptions.Default);

0 commit comments

Comments
 (0)