init: 导入项目到 meswork Gitea
This commit is contained in:
56
DataMirrorTools_Simulator/LogNet/LogNet.cs
Normal file
56
DataMirrorTools_Simulator/LogNet/LogNet.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
[assembly: log4net.Config.XmlConfigurator(Watch = true)]
|
||||
namespace LogNet
|
||||
{
|
||||
|
||||
public class LogisTrac
|
||||
{
|
||||
/// <summary>
|
||||
/// 输出日志到Log4Net
|
||||
/// </summary>
|
||||
/// <param name="t"></param>
|
||||
/// <param name="ex"></param>
|
||||
#region static void WriteLog(Type t, Exception ex)
|
||||
|
||||
public static void WriteLog(Type t, Exception ex)
|
||||
{
|
||||
log4net.ILog log = log4net.LogManager.GetLogger(t);
|
||||
log.Error("Error", ex);
|
||||
}
|
||||
|
||||
public static void WriteLog(string t, Exception ex)
|
||||
{
|
||||
log4net.ILog log = log4net.LogManager.GetLogger(t);
|
||||
log.Error("Error", ex);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 输出日志到Log4Net
|
||||
/// </summary>
|
||||
/// <param name="t"></param>
|
||||
/// <param name="msg"></param>
|
||||
#region static void WriteLog(Type t, string msg)
|
||||
|
||||
public static void WriteLog(Type t, string msg)
|
||||
{
|
||||
log4net.ILog log = log4net.LogManager.GetLogger(t);
|
||||
log.Error(msg);
|
||||
}
|
||||
public static void WriteLog(string t, string msg)
|
||||
{
|
||||
log4net.ILog log = log4net.LogManager.GetLogger(t);
|
||||
log.Error(msg);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user