using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
namespace USALibrary.Common
{
/// <summary>
/// log4net日志辅助类
/// </summary>
public class Logging
{
public static log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
/// <summary>
/// 致命错误信息
/// </summary>
/// <param name="strMsg"></param>
public static void Fatal(string strMsg)
{
log.Fatal(strMsg);
}
/// <summary>
/// 致命错误信息
/// </summary>
/// <param name="ex">Exception</param>
public static void Fatal(Exception ex)
{
log.Fatal(ex.ToString());
}
/// <summary>
/// 错误信息
/// </summary>
/// <param name="strMsg"></param>
public static void Error(string strMsg)
{
log.Error(strMsg);
}
/// <summary>
/// 错误信息
/// </summary>
/// <param name="strMsg">Exception</param>
public static void Error(Exception ex)
{
log.Error(ex.ToString());
}
/// <summary>
/// 警告信息
/// </summary>
/// <param name="strMsg"></param>
public static void Warn(string strMsg)
{
log.Warn(strMsg);
}
/// <summary>
/// 警告信息
/// </summary>
/// <param name="ex">Exception</param>
public static void Warn(Exception ex)
{
log.Warn(ex.ToString());
}
/// <summary>
/// 调试信息
/// </summary>
/// <param name="strMsg"></param>
public static void Debug(string strMsg)
{
log.Debug(strMsg);
}
/// <summary>
/// 调试信息
/// </summary>
/// <param name="ex">Exception</param>
public static void Debug(Exception ex)
{
log.Debug(ex.ToString());
}
/// <summary>
/// 一般信息
/// </summary>
/// <param name="strMsg"></param>
public static void Info(string strMsg)
{
log.Info(strMsg);
}
/// <summary>
/// 一般信息
/// </summary>
/// <param name="strMsg">Exception</param>
public static void Info(Exception ex)
{
log.Info(ex.ToString());
}
/// <summary>
/// 初始化log4net配置
/// </summary>
public static void InitLog()
{
log4net.Config.XmlConfigurator.Configure();
}
}
}
网友评论