You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

54 lines
1.4 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Leit.FrameWork.Log
{
public partial class LogHelper
{
/// <summary>
/// 静态只读实体对象info信息
/// </summary>
public static readonly log4net.ILog Loginfo = log4net.LogManager.GetLogger("logInfo");
/// <summary>
/// 静态只读实体对象error信息
/// </summary>
public static readonly log4net.ILog Logerror = log4net.LogManager.GetLogger("logError");
/// <summary>
/// 添加info信息
/// </summary>
/// <param name="info">自定义日志内容说明</param>
public static void WriteLog(string info)
{
try
{
if (Loginfo.IsInfoEnabled)
{
Loginfo.Info(info);
}
}
catch { }
}
/// <summary>
/// 添加异常信息
/// </summary>
/// <param name="info">自定义日志内容说明</param>
/// <param name="ex">异常信息</param>
public static void WriteLog(string info, Exception ex)
{
try
{
if (Logerror.IsErrorEnabled)
{
Logerror.Error(info, ex);
}
}
catch { }
}
}
}