规范并补充日志内容
This commit is contained in:
@@ -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)
|
||||
// --------------------------------------------------------
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
public static string Core { get; } = "Core"; // 系统主逻辑/启动关闭
|
||||
public static string Network { get; } = "Network"; // 底层网络通讯 (TCP/UDP)
|
||||
public static string WebApi { get; } = "WebAPI"; // 对外 HTTP 接口
|
||||
public static string gRpc { get; } = "gRPC"; // 对外 gRPC 接口
|
||||
public static string gRpc { get; } = "gRpc"; // 对外 gRpc 接口
|
||||
|
||||
public static string WebSocket { get; } = "WebSocket"; // 实时通讯
|
||||
public static string Ping { get; } = "Ping"; // 心跳/Ping包 (通常量大且不重要)
|
||||
|
||||
Reference in New Issue
Block a user