SVN r1066
SVN-Revision: r1066
This commit is contained in:
@@ -0,0 +1,143 @@
|
||||
using Common.Logging;
|
||||
using Lskj.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Lskj.Util
|
||||
{
|
||||
public static class LoggerHandler
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public static void Debug(this object happenobj, object message)
|
||||
{
|
||||
if (log.IsDebugEnabled)
|
||||
{
|
||||
try
|
||||
{
|
||||
log.Debug(new LogInfo(happenobj) { msg = message });
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Error(message, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void Debug(this object happenobj, object message, Exception exception)
|
||||
{
|
||||
if (log.IsDebugEnabled)
|
||||
try
|
||||
{
|
||||
log.Debug(new LogInfo(happenobj) { msg = message, exception = exception });
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Error(message, e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void Error(this object happenobj, object message)
|
||||
{
|
||||
if (log.IsErrorEnabled)
|
||||
try
|
||||
{
|
||||
log.Error(new LogInfo(happenobj) { msg = message });
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Error(message, e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void Error(this object happenobj, object message, Exception exception)
|
||||
{
|
||||
if (log.IsErrorEnabled)
|
||||
try
|
||||
{
|
||||
log.Error(new LogInfo(happenobj) { msg = message, exception = exception });
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
public static void Fatal(this object happenobj, object message)
|
||||
{
|
||||
if (log.IsFatalEnabled)
|
||||
try
|
||||
{
|
||||
log.Fatal(new LogInfo(happenobj) { msg = message });
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Error(message, e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void Fatal(this object happenobj, object message, Exception exception)
|
||||
{
|
||||
if (log.IsFatalEnabled)
|
||||
try
|
||||
{
|
||||
log.Fatal(new LogInfo(happenobj) { msg = message, exception = exception });
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Error(message, e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void Info(this object happenobj, object message)
|
||||
{
|
||||
if (log.IsInfoEnabled)
|
||||
try
|
||||
{
|
||||
log.Info(new LogInfo(happenobj) { msg = message });
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Error(message, e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void Info(this object happenobj, object message, Exception exception)
|
||||
{
|
||||
if (log.IsInfoEnabled)
|
||||
try
|
||||
{
|
||||
log.Info(new LogInfo(happenobj) { msg = message, exception = exception });
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Error(message, e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void Warn(this object happenobj, object message)
|
||||
{
|
||||
if (log.IsWarnEnabled)
|
||||
try
|
||||
{
|
||||
log.Warn(new LogInfo(happenobj) { msg = message });
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Error(message, e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void Warn(this object happenobj, object message, Exception exception)
|
||||
{
|
||||
if (log.IsWarnEnabled)
|
||||
try
|
||||
{
|
||||
log.Warn(new LogInfo(happenobj) { msg = message, exception = exception });
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Error(message, e);
|
||||
}
|
||||
}
|
||||
private st
|
||||
Reference in New Issue
Block a user