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.

74 lines
2.0 KiB
C#

2 years ago
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");
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);
}
}
}
}