using System;
using System.Collections.Generic;
using System.Text;

namespace JiaWel.Utilities
{
public static class ExceptionHelper
{
//日志记录
private static readonly log4net.ILog log = log4net.LogManager.GetLogger("JiaWel.LOG4");

/// <summary>
/// 记录错误信息
/// </summary>
/// <param name="method">调用的方法名称</param>
/// <param name="message">错误详细信息</param>
public static void WriteException(string method, string message)
{
try
{
lock (log)
{
log.ErrorFormat(DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") + " | " + method + " | 详情:" + message);
}
}
catch (System.Exception)
{
// throw;
}
}

/// <summary>
/// 记录错误信息
/// </summary>
/// <param name="method">调用的方法名称</param>
/// <param name="message">错误详细信息</param>
public static void WriteErrorMessage(string method, string message)
{
try
{
lock (log)
{
log.ErrorFormat(DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") + " | " + method + " | 详情:" + message);
}
}
catch (System.Exception)
{
// throw;
}
}

/// <summary>
/// 记录提示信息
/// </summary>
/// <param name="message"></param>
public static void WriteInfoMessage(string method, string message)
{
try
{
lock (log)
{
log.InfoFormat(DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") + " | " + method + " | 详情:" + message);
}
}
catch (Exception)
{
// throw;
}
}
}
}

相关文章:

  • 2021-11-21
  • 2022-12-23
  • 2022-02-08
  • 2021-10-02
  • 2022-02-08
猜你喜欢
  • 2021-11-25
  • 2021-12-06
  • 2022-02-11
  • 2022-12-23
  • 2022-12-23
  • 2021-11-30
  • 2021-09-23
相关资源
相似解决方案