Skip to content

Commit 35ea6ba

Browse files
committed
feat(日志): 添加服务器类型和ID到日志选项
当服务器类型不为空或ID大于0时,将服务器类型、ID和实例ID拼接为LogType
1 parent b434eaa commit 35ea6ba

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

GameFrameX.StartUp/GameApp.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,25 @@ public static async Task Entry(string[] args, Action initAction, Action<LogOptio
113113
LogOptions.Default.FileSizeLimitBytes = launcherOptions.LogFileSizeLimitBytes;
114114
LogOptions.Default.LogEventLevel = launcherOptions.LogEventLevel;
115115
LogOptions.Default.RollingInterval = launcherOptions.LogRollingInterval;
116+
// 构建LogType,当值为空或默认值时不拼接
117+
var logTypeParts = new List<string>();
118+
119+
if (!string.IsNullOrWhiteSpace(launcherOptions.ServerType))
120+
{
121+
logTypeParts.Add(launcherOptions.ServerType);
122+
}
123+
124+
if (launcherOptions.ServerId > 0)
125+
{
126+
logTypeParts.Add(launcherOptions.ServerId.ToString());
127+
}
128+
129+
if (launcherOptions.ServerInstanceId > 0)
130+
{
131+
logTypeParts.Add(launcherOptions.ServerInstanceId.ToString());
132+
}
133+
134+
LogOptions.Default.LogType = logTypeParts.Count > 0 ? string.Join("_", logTypeParts) : null;
116135
}
117136

118137
logConfiguration?.Invoke(LogOptions.Default);

0 commit comments

Comments
 (0)