public static void WriteErrLog(Exception ex) { if (ExceptionlessClient != null) { Exceptionlogger.LogInfo(ex); } else { var logEntity = new LogEntity { LogType = ex.GetType().FullName, LogDetail = CreateErrDetail(ex), LogMessage = ex.Message, LogTime = DateTime.Now }; Filelogger.LogInfo(logEntity); } }
private static void WriteMessageToExceptionless(LogEntity logEntity, LogLevel logLevel) { var tag = "信息"; if (logLevel == LogLevel.Warn) { tag = "警告"; } if (logLevel == LogLevel.Trace) { tag = "跟踪"; } ExceptionlessClient.CreateLog(logEntity.ToString(), logLevel) .AddTags(tag) .SetReferenceId(Guid.NewGuid().ToString("N")) .SetProperty("IpAddress", Computer.IpAddress) .SetProperty("MacAddress", Computer.MacAddress) .Submit(); }
public static void WriteTraceLog(string info) { if (!LogTraceEnable) { return; } var logEntity = new LogEntity { LogType = "跟踪", LogDetail = string.Empty, LogMessage = info, LogTime = DateTime.Now }; if (ExceptionlessClient != null) { Tracelogger.LogInfo(logEntity); } else { Filelogger.LogInfo(logEntity); } }