You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

80 lines
2.1 KiB

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