using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace KH.WMS.Core.Logging.Serilog { /// /// 日志配置选项 /// public class SerilogOptions { /// /// 最低日志级别 /// public string MinimumLevel { get; set; } = "Information"; /// /// 日志目录 /// public string LogDirectory { get; set; } = "Logs"; /// /// 日志保留天数 /// public int RetentionDays { get; set; } = 30; /// /// 单个文件最大大小(MB) /// public int MaxFileSizeMB { get; set; } = 100; /// /// 是否按模块分离日志 /// public bool SplitByModule { get; set; } = false; /// /// 是否输出到控制台 /// public bool WriteToConsole { get; set; } = true; /// /// 是否输出到文件 /// public bool WriteToFile { get; set; } = true; /// /// 模块级别覆盖 /// public Dictionary ModuleOverrides { get; set; } = new() { ["Microsoft"] = "Warning", ["Microsoft.EntityFrameworkCore"] = "Warning", ["System"] = "Warning" }; /// /// 自定义日志文件名(不含路径和扩展名,例如: "myapp" 会生成 "myapp-.txt") /// 为 null 时使用默认文件名 /// public string? CustomLogFileName { get; set; } /// /// 自定义错误日志文件名(不含路径和扩展名) /// 为 null 时使用默认文件名 "error" /// public string? CustomErrorFileName { get; set; } /// /// 自定义警告日志文件名(不含路径和扩展名) /// 为 null 时使用默认文件名 "warning" /// public string? CustomWarningFileName { get; set; } } }