规范并补充日志内容

This commit is contained in:
2026-01-16 14:30:42 +08:00
parent 4e0bb33ce2
commit fd6a82eb4e
28 changed files with 325 additions and 537 deletions

View File

@@ -83,7 +83,7 @@ namespace Ayay.SerilogLogs
// 定义通用模板:包含了 SourceContext (模块名), TraceId, AppId
// 示例: 2026-01-15 12:00:01 [INF] [Algorithm] [Dev01] 计算完成
string outputTemplate = "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] [{SourceContext}] [{AppId}] {Message:lj}{NewLine}{Exception}";
string outputTemplate = "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] [{SourceContext}] {Message:lj}{NewLine}{Exception}";
// 3.1 控制台输出 (开发调试用)
builder.WriteTo.Async(a => a.Console(
@@ -167,6 +167,9 @@ namespace Ayay.SerilogLogs
// --------------------------------------------------------
Log.Logger = builder.CreateLogger();
// 支持 Emoji 显示
Console.OutputEncoding = Encoding.UTF8;
// --------------------------------------------------------
// 5. 启动后台清理任务 (LogCleaner)
// --------------------------------------------------------