97 lines
2.2 KiB
C#
97 lines
2.2 KiB
C#
using log4net;
|
|
using System;
|
|
using System.Reflection;
|
|
|
|
namespace APT.Infrastructure.Core
|
|
{
|
|
/// <summary>
|
|
/// log4net日志记录器
|
|
/// </summary>
|
|
public class Log4netLogger : ILog4netLogger
|
|
{
|
|
private readonly log4net.ILog _logger;
|
|
|
|
#region ctor.
|
|
|
|
public Log4netLogger(string name)
|
|
{
|
|
_logger = LogManager.GetLogger(Assembly.GetEntryAssembly(), name);
|
|
}
|
|
#endregion
|
|
|
|
#region ILog 成员
|
|
|
|
public void Debug(object message)
|
|
{
|
|
_logger.Debug(message);
|
|
}
|
|
|
|
public void Debug(string format, params object[] args)
|
|
{
|
|
_logger.DebugFormat(format, args);
|
|
}
|
|
|
|
public void Info(object message)
|
|
{
|
|
_logger.Info(message);
|
|
}
|
|
|
|
public void Info(string format, params object[] args)
|
|
{
|
|
_logger.InfoFormat(format, args);
|
|
}
|
|
|
|
public void Warn(object message)
|
|
{
|
|
_logger.Warn(message);
|
|
}
|
|
|
|
public void Warn(string format, params object[] args)
|
|
{
|
|
_logger.WarnFormat(format, args);
|
|
}
|
|
|
|
public void Error(object message)
|
|
{
|
|
_logger.Error(message);
|
|
}
|
|
|
|
public void Error(string format, params object[] args)
|
|
{
|
|
_logger.ErrorFormat(format, args);
|
|
}
|
|
|
|
public void Error(object message, Exception exception)
|
|
{
|
|
_logger.Error(message, exception);
|
|
}
|
|
|
|
public void Error(string format, Exception exception, params object[] args)
|
|
{
|
|
_logger.ErrorFormat(format, exception, args);
|
|
}
|
|
|
|
public void Fatal(object message)
|
|
{
|
|
_logger.Fatal(message);
|
|
}
|
|
|
|
public void Fatal(string format, params object[] args)
|
|
{
|
|
_logger.FatalFormat(format, args);
|
|
}
|
|
|
|
public void Fatal(object message, Exception exception)
|
|
{
|
|
_logger.Fatal(message, exception);
|
|
}
|
|
|
|
public void Fatal(string format, Exception exception, params object[] args)
|
|
{
|
|
_logger.FatalFormat(format, exception, args);
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|