You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
96 lines
2.7 KiB
C#
96 lines
2.7 KiB
C#
using log4net;
|
|
using System;
|
|
|
|
namespace Rs.Framework
|
|
{
|
|
/// <summary>
|
|
/// 日志帮助类
|
|
///
|
|
/// </summary>
|
|
public class LogHelper
|
|
{
|
|
private static readonly ILog logerror = LogManager.GetLogger("Error");
|
|
private static readonly ILog logdebug = LogManager.GetLogger("Debug");
|
|
private static readonly ILog logingo = LogManager.GetLogger("Info");
|
|
private static readonly ILog logwarning = LogManager.GetLogger("Warning");
|
|
private static readonly ILog logmove = LogManager.GetLogger("Move");
|
|
private static readonly ILog logM1Debug = LogManager.GetLogger("M1Debug");
|
|
private static readonly ILog logM2Debug = LogManager.GetLogger("M2Debug");
|
|
|
|
public static void Error(string content) { logerror.Error(content);}
|
|
|
|
public static void Error(string content, Exception ex)
|
|
{
|
|
if (logerror.IsErrorEnabled)
|
|
{
|
|
logerror.Error(content, ex);
|
|
}
|
|
}
|
|
|
|
public static void Debug(string content) { logdebug.Debug(content);}
|
|
|
|
public static void Debug(string content, Exception ex)
|
|
{
|
|
if (logdebug.IsDebugEnabled)
|
|
{
|
|
logdebug.Debug(content, ex);
|
|
}
|
|
}
|
|
|
|
public static void Info(string content) { logingo.Info(content);}
|
|
|
|
public static void Info(string content, Exception ex)
|
|
{
|
|
if (logingo.IsInfoEnabled)
|
|
{
|
|
logingo.Info(content, ex);
|
|
}
|
|
}
|
|
|
|
public static void Warning(string content) { logwarning.Info(content); }
|
|
|
|
public static void Warning(string content, Exception ex)
|
|
{
|
|
if (logwarning.IsInfoEnabled)
|
|
{
|
|
logwarning.Info(content, ex);
|
|
}
|
|
}
|
|
|
|
public static void MoveLog(string content)
|
|
{
|
|
if (logmove.IsInfoEnabled)
|
|
{
|
|
logmove.Info(content);
|
|
}
|
|
}
|
|
public static void MoveLog(string content, Exception ex)
|
|
{
|
|
if (logmove.IsInfoEnabled)
|
|
{
|
|
logmove.Info(content, ex);
|
|
}
|
|
}
|
|
|
|
public static void DebugM1(string content) { logM1Debug.Info(content); }
|
|
|
|
public static void DebugM1(string content, Exception ex)
|
|
{
|
|
if (logM1Debug.IsInfoEnabled)
|
|
{
|
|
logM1Debug.Info(content, ex);
|
|
}
|
|
}
|
|
|
|
public static void DebugM2(string content) { logM2Debug.Info(content); }
|
|
|
|
public static void DebugM2(string content, Exception ex)
|
|
{
|
|
if (logM2Debug.IsInfoEnabled)
|
|
{
|
|
logM2Debug.Info(content, ex);
|
|
}
|
|
}
|
|
}
|
|
}
|