Skip to content

Commit ab4a088

Browse files
committed
refactor(Logger): 简化日志输出模板和属性配置
移除日志模板中的LogType字段和不再需要的属性配置,使日志格式更简洁
1 parent 4f92160 commit ab4a088

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

GameFrameX.Foundation.Logger/LogHandler.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,12 @@ public static LoggerConfiguration CreateLoggerConfiguration()
5757
/// <summary>
5858
/// 控制台输出模板,用于格式化控制台日志输出。
5959
/// </summary>
60-
const string ConsoleOutputTemplate = "[{Timestamp:HH:mm:ss} {Level:u3}][{LogType}-{TagName}]{Message:lj}{NewLine}{Exception}";
60+
const string ConsoleOutputTemplate = "[{Timestamp:HH:mm:ss} {Level:u3}][{TagName}]{Message:lj}{NewLine}{Exception}";
6161

6262
/// <summary>
6363
/// 文件输出模板,用于格式化文件日志输出。
6464
/// </summary>
65-
const string FileOutputTemplate = "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}][{LogType}-{TagName}] {Message:lj}{NewLine}{Exception}";
65+
const string FileOutputTemplate = "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}][{TagName}]{Message:lj}{NewLine}{Exception}";
6666

6767
/// <summary>
6868
/// 启动并配置日志系统
@@ -107,9 +107,7 @@ public static ILogger Create(LogOptions logOptions, bool isDefault = true, Actio
107107
}
108108

109109
var logger = CreateLoggerConfiguration();
110-
logger.Enrich.WithProperty("LogType", logOptions.LogType);
111-
logger.Enrich.WithProperty("FriendlyName", AppDomain.CurrentDomain.FriendlyName);
112-
logger.Enrich.WithProperty("TagName", logOptions.LogTagName ?? "");
110+
logger.Enrich.WithProperty("TagName", logOptions.LogTagName);
113111

114112
if (logOptions.IsGrafanaLoki)
115113
{

0 commit comments

Comments
 (0)