using System.ComponentModel.DataAnnotations;
namespace LTEMvcApp.Models
{
///
/// 日志层配置
///
public class LogLayerConfig
{
///
/// 日志级别
///
[Required]
public string Level { get; set; } = "warn";
///
/// 最大大小
///
public int MaxSize { get; set; } = 1;
///
/// 是否包含负载
///
public bool Payload { get; set; } = false;
///
/// 过滤器(用于兼容性)
///
public string Filter { get; set; } = "warn";
}
///
/// 日志层类型枚举
///
public static class LogLayerTypes
{
public const string PHY = "PHY";
public const string MAC = "MAC";
public const string RLC = "RLC";
public const string PDCP = "PDCP";
public const string RRC = "RRC";
public const string NAS = "NAS";
public const string S1AP = "S1AP";
public const string NGAP = "NGAP";
public const string GTPU = "GTPU";
public const string X2AP = "X2AP";
public const string XnAP = "XnAP";
public const string M2AP = "M2AP";
public const string EVENT = "EVENT";
///
/// 获取所有日志层类型
///
public static readonly string[] AllLayers = new[]
{
PHY, MAC, RLC, PDCP, RRC, NAS, S1AP, NGAP, GTPU, X2AP, XnAP, M2AP, EVENT
};
///
/// 获取日志级别选项
///
public static readonly string[] LogLevels = new[]
{
"debug", "info", "warn", "error"
};
///
/// 获取默认日志级别
///
public static string GetDefaultLevel(string layer)
{
return layer switch
{
NAS or RRC or S1AP or NGAP or X2AP => "debug",
EVENT or M2AP => "info",
_ => "warn"
};
}
}
}