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.
54 lines
1.6 KiB
54 lines
1.6 KiB
using System;
|
|
using System.Text.Json.Serialization;
|
|
|
|
namespace CoreAgent.Domain.Models.Protocol;
|
|
|
|
/// <summary>
|
|
/// 网络层日志集合
|
|
/// 用于统一管理不同网络层的日志配置
|
|
/// </summary>
|
|
public class NetworkLayerLogs
|
|
{
|
|
/// <summary>
|
|
/// IMS层日志配置
|
|
/// </summary>
|
|
public ImsLayerLog ImsLog { get; set; }
|
|
|
|
/// <summary>
|
|
/// RAN层日志配置
|
|
/// </summary>
|
|
public RanLayerLog RanLog { get; set; }
|
|
|
|
/// <summary>
|
|
/// 初始化所有网络层的日志级别
|
|
/// </summary>
|
|
/// <param name="isNonStandaloneMode">是否为非独立组网模式(NSA模式)</param>
|
|
public void InitializeAllLogLevels(bool isNonStandaloneMode = false)
|
|
{
|
|
ImsLog = new ImsLayerLog();
|
|
RanLog = new RanLayerLog();
|
|
|
|
ImsLog.InitializeLogLevels();
|
|
RanLog.InitializeLogLevels(isNonStandaloneMode);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 更新指定网络层和指定层的日志级别
|
|
/// </summary>
|
|
/// <param name="networkType">网络类型("IMS" 或 "RAN")</param>
|
|
/// <param name="layerName">层名称</param>
|
|
/// <param name="logLevel">日志级别</param>
|
|
/// <returns>是否更新成功</returns>
|
|
public bool UpdateLogLevel(string networkType, string layerName, LogLevel logLevel)
|
|
{
|
|
if (string.IsNullOrEmpty(networkType) || string.IsNullOrEmpty(layerName))
|
|
return false;
|
|
|
|
return networkType.ToUpper() switch
|
|
{
|
|
"IMS" => ImsLog?.UpdateLogLevel(layerName, logLevel) ?? false,
|
|
"RAN" => RanLog?.UpdateLogLevel(layerName, logLevel) ?? false,
|
|
_ => false
|
|
};
|
|
}
|
|
}
|