SVN r1066

SVN-Revision: r1066
This commit is contained in:
tdx
2025-12-03 03:18:14 +00:00
parent 149ae2cec6
commit 1536d4dc5f
3 changed files with 229 additions and 1 deletions
+143
View File
@@ -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