首次提交
This commit is contained in:
49
MW_Log/LoggerHelper.cs
Normal file
49
MW_Log/LoggerHelper.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
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)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user