Files
WC-CZGKJ/MW_Log/LoggerHelper.cs
2026-05-11 11:09:04 +08:00

50 lines
1.0 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using log4net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MW_Log
{
/// <summary>
/// LoggerHelper
/// </summary>
public class LoggerHelper
{
/// <summary>
/// LogInfo
/// </summary>
private static readonly ILog LogInfo = LogManager.GetLogger("LogInfo");
/// <summary>
/// 记录Info日志
/// </summary>
/// <param name="msg"></param>
/// <param name="ex"></param>
public static void Info(string type, string msg, Exception ex = null)
{
try
{
msg = $"【类别:{type}】\r\n【内容】{msg}";
if (ex != null)
{
LogInfo.Info(msg, ex);
}
else
{
LogInfo.Info(msg);
}
}
catch (Exception err)
{
}
}
}
}