统一 Dump、Logging、Database 等功能的配置文件加载和定义类,优化ConfigLoader,职责分散各个模块。

This commit is contained in:
QI Mingxuan
2026-05-15 15:49:02 +08:00
parent 07d76f5ab1
commit ad719d157b
7 changed files with 239 additions and 2 deletions
@@ -0,0 +1,43 @@
using System;
using System.IO;
namespace XP.Common.Logging.Configs
{
/// <summary>
/// Serilog 日志配置实体(从 App.config 读取)| Serilog logging configuration entity (loaded from App.config)
/// </summary>
public class SerilogConfig
{
/// <summary>
/// 日志输出根路径(默认:AppData/Files/Logs| Log output root path (default: AppData/Files/Logs)
/// </summary>
public string LogPath { get; set; } = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
"Files", "Logs");
/// <summary>
/// 最低日志级别(Debug/Info/Warn/Error/Fatal| Minimum log level
/// </summary>
public string MinimumLevel { get; set; } = "Info";
/// <summary>
/// 是否输出到控制台(调试环境=true,生产环境=false| Whether to output to console
/// </summary>
public bool EnableConsole { get; set; } = true;
/// <summary>
/// 日志文件分割规则(Day/Month/Hour/Size| Log file rolling interval
/// </summary>
public string RollingInterval { get; set; } = "Day";
/// <summary>
/// 单个日志文件最大大小(MB,仅 Size 分割时生效)| Single log file max size (MB)
/// </summary>
public long FileSizeLimitMB { get; set; } = 100;
/// <summary>
/// 保留日志文件数量(默认30天)| Retained file count limit (default 30)
/// </summary>
public int RetainedFileCountLimit { get; set; } = 30;
}
}