/// <summary> /// 写入日志 /// </summary> /// <param name="logContent">日志内容</param> /// <param name="logType">日志类型</param> public static void WriteSysLog(string logContent, EnumType.LogType logType) { string userName = null; try { userName = Base_UserBusiness.GetCurrentUser().UserName; } catch { } Base_SysLog newLog = new Base_SysLog { Id = Guid.NewGuid().ToSequentialGuid(), LogType = logType.ToString(), LogContent = logContent.Replace("\r\n", "<br />").Replace(" ", " "), OpTime = DateTime.Now, OpUserName = userName }; Task.Run(() => { try { LoggerFactory.GetLogger().WriteSysLog(newLog); } catch { } }); }
/// <summary> /// 写入日志 /// </summary> /// <param name="logContent">日志内容</param> /// <param name="logType">日志类型</param> public void WriteSysLog(string logContent, EnumType.LogType logType, string data = null) { string userName = null; try { userName = Operator.Property.RealName; } catch { } Base_SysLog newLog = new Base_SysLog { Id = IdHelper.GetId(), LogType = logType.ToString(), LogContent = logContent.Replace("\r\n", "<br />").Replace(" ", " "), OpTime = DateTime.Now, OpUserName = userName, Data = data }; Task.Run(() => { try { LoggerFactory.GetLogger().WriteSysLog(newLog); } catch { } }); }
protected Base_SysLog GetBase_SysLogInfo(LogEventInfo logEventInfo) { string id = string.Empty; try { id = IdHelper.GetId(); } catch { } if (id.IsNullOrEmpty()) { id = Guid.NewGuid().ToString(); } Base_SysLog newLog = new Base_SysLog { Id = id, Data = logEventInfo.Properties[LoggerConfig.Data] as string, Level = logEventInfo.Level.ToString(), LogContent = logEventInfo.Message, LogType = logEventInfo.Properties[LoggerConfig.LogType] as string, OpTime = logEventInfo.TimeStamp, OpUserName = logEventInfo.Properties[LoggerConfig.OpUserName] as string }; return(newLog); }
private void WriteLogUsu(object obSysLog) { Base_SysLog VSysLog = (Base_SysLog)obSysLog; //保存的方法 Base_SysLogDal.Insert(VSysLog); }
protected override void OnWrite(LogLevel level, string message) { Base_SysLog base_SysLog = new Base_SysLog() { LogContent = message, LogCreateTime = DateTime.Now.ToString(), LogOrigin = "System", LogType = level.ToString() }; repository.Insert(base_SysLog); }
protected override void OnWrite(LogLevel level, string message) { Base_SysLog base_SysLog = new Base_SysLog() { LogContent = message, LogCreateTime = DateTime.Now.ToString(), LogOrigin = "System", LogType = level.ToString() }; bus.Publish(base_SysLog, "RabbitMQ.Log"); }
protected Base_SysLog GetBase_SysLogInfo(LogEventInfo logEventInfo) { Base_SysLog newLog = new Base_SysLog { Id = IdHelper.GetId(), Data = logEventInfo.Properties[LoggerConfig.Data] as string, Level = logEventInfo.Level.ToString(), LogContent = logEventInfo.Message, LogType = logEventInfo.Properties[LoggerConfig.LogType] as string, OpTime = logEventInfo.TimeStamp, OpUserName = logEventInfo.Properties[LoggerConfig.OpUserName] as string }; return(newLog); }
public void WriteSysLog(Base_SysLog log) { _db.Insert(log); }
public void WriteSysLog(Base_SysLog log) { GetElasticClient().IndexDocument(log); }