using Nirvana.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace YBDevice.Service.DBServices
{
///
/// 日志记录
///
public class LoggerApp
{
///
/// 记录文本日志
///
///
///
public void InsertErrorLog(string msg, int type = 1)
{
LogFactory.InsertErrorLog(msg, type);
}
///
/// 记录文本日志
/// ye m
/// 参数
/// 异常
/// 类型
/// 程序名称
public void InsertErrorLog(Exception ex, string param = "", string program = "", int type = 1)
{
var msg = $"ex:{ex.Message},source:{ex.Source}\r\nstack:{ex.StackTrace}";
if (ex.InnerException != null)
{
msg = $"{msg}\r\nInnerException.Message:{ex.InnerException.Message},InnerException.Source:{ex.InnerException.Source}\r\nInnerException.StackTrace:{ex.InnerException.StackTrace}";
}
if (!string.IsNullOrEmpty(param))
{
msg = $"参数:{param}\r\n{msg}";
}
if (!string.IsNullOrEmpty(program))
{
msg = $"{program}:{msg}";
}
InsertErrorLog(msg, type);
}
}
}