68 lines
1.6 KiB
C#
68 lines
1.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.ServiceModel.Channels;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace MyCode.Project.Infrastructure.Common
|
|
{
|
|
public class LogHelper
|
|
{
|
|
private static readonly log4net.ILog log = log4net.LogManager.GetLogger("MyCode.Logger");
|
|
|
|
#region Error(错误记录)
|
|
public static void Error(string message, Exception ex)
|
|
{
|
|
log.Error(message, ex);
|
|
}
|
|
#endregion
|
|
|
|
#region Error(错误记录)
|
|
public static void Error(object obj)
|
|
{
|
|
log.Error(obj + Environment.NewLine);
|
|
}
|
|
#endregion
|
|
|
|
#region Debug(Debug存到数据库中)
|
|
/// <summary>
|
|
/// Debug存到数据库中
|
|
/// </summary>
|
|
/// <param name="message"></param>
|
|
public static void Debug(string message)
|
|
{
|
|
log.Debug(message);
|
|
}
|
|
#endregion
|
|
|
|
#region Debug(Debug存在数据库中)
|
|
/// <summary>
|
|
/// Debug存在数据库中
|
|
/// </summary>
|
|
/// <param name="obj"></param>
|
|
public static void Debug(object obj)
|
|
{
|
|
log.Debug(JsonHelper.ToJson(obj));
|
|
}
|
|
#endregion
|
|
|
|
#region Info(信息日志)
|
|
public static void Info(string message)
|
|
{
|
|
log.Info(message + Environment.NewLine);
|
|
}
|
|
#endregion
|
|
|
|
#region Info(信息日志)
|
|
public static void Info(object obj)
|
|
{
|
|
if (obj != null)
|
|
{
|
|
log.Info(JsonHelper.ToJson(obj));
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
}
|