using HighWayIot.Repository.service; using HighWayIot.Repository.domain; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using HighWayIot.Log4net; namespace HighWayIot.Winform.Business { public class SqlLogHelper { private static LogHelper logHelper = LogHelper.Instance; /// /// 日志信息服务类 /// private static SysLogService sysLogService = SysLogService.Instance; /// /// 报警日志信息服务类 /// private static SysErrorLogService sysErrorLogService = SysErrorLogService.Instance; /// /// 日志插入数据库 /// public static void AddLog(string text, int? p1 = null, int? p2 = null, int? p3 = null) { logHelper.Info(text); sysLogService.InsertLogInfo(new SysLogEntity() { Text = text, LogTime = DateTime.Now, Operator = RoleBusiness.LoginUserName, P1 = p1, P2 = p2, P3 = p3, }); } /// /// 错误日志插入数据库 /// public static void AddErrorLog(string text, int? p1 = null, int? p2 = null, int? p3 = null) { logHelper.Error(text); sysErrorLogService.InsertErrorLogInfo(new SysErrorLogEntity() { Text = text, LogTime = DateTime.Now, Operator = RoleBusiness.LoginUserName, P1 = p1, P2 = p2, P3 = p3, }); } } }