public void EmitLog(LogEntry log) { RestClient client = new RestClient(); client.InvokeAsync(m_Url, log, m_Method, m_Format, ex => { string message = string.Format("Write log failed.\r\n\r\n Error Info: {0}. \r\n\r\n Log Type: {1}. \r\n\r\n Log Info: {2}", ex.ToString(), this.GetType().AssemblyQualifiedName, log.SerializationWithoutException()); Logger.WriteEventLog(message, System.Diagnostics.EventLogEntryType.Error); }); }
public void EmitLog(LogEntry log) { SoapEntityMapping.Add<LogEntry>(); SoapEntityMapping.Add<ExtendedPropertyData>(); SoapClient.InvokeAsync(m_Url, m_MethodName, null, ex => { string message = string.Format("Write log failed.\r\n\r\n Error Info: {0}. \r\n\r\n Log Type: {1}. \r\n\r\n Log Info: {2}", ex.ToString(), this.GetType().AssemblyQualifiedName, log.SerializationWithoutException()); Logger.WriteEventLog(message, System.Diagnostics.EventLogEntryType.Error); }, log); }
public void EmitLog(LogEntry log) { if (!Directory.Exists(m_LogFolderPath)) { Directory.CreateDirectory(m_LogFolderPath); } WriteToFile(log.SerializationWithoutException(), Path.Combine(m_LogFolderPath, DateTime.Now.ToString("yyyy-MM-dd") + ".txt")); }
private static string WriteLog(LogEntry log) { List<ILogEmitter> logEmitterList; try { logEmitterList = EmitterFactory.Create(); } catch(Exception ex) { string message = string.Format("Failed to create log emitter instance.\r\n\r\n Error Info: {0}. \r\n\r\n Log Info: {1}", ex.ToString(), log.SerializationWithoutException()); WriteEventLog(message, EventLogEntryType.Error); return log.LogID.ToString(); } return WriteLog(log, logEmitterList); }
private static string WriteLog(LogEntry log, List<ILogEmitter> logEmitterList) { if (logEmitterList == null || logEmitterList.Count <= 0) { return log.LogID.ToString(); } try { foreach (var logEmitter in logEmitterList) { if (logEmitter == null) { continue; } try { logEmitter.EmitLog(log); } catch (Exception ex) { string message = string.Format("Write log failed.\r\n\r\n Error Info: {0}. \r\n\r\n Log Type: {1}. \r\n\r\n Log Info: {2}", ex.ToString(), logEmitter.GetType().AssemblyQualifiedName, log.SerializationWithoutException()); Logger.WriteEventLog(message, EventLogEntryType.Error); } } } catch(Exception ex) { string message = string.Format("Write log failed.\r\n\r\n Error Info: {0}. \r\n\r\n Log Info: {1}", ex.ToString(), log.SerializationWithoutException()); Logger.WriteEventLog(message, EventLogEntryType.Error); } return log.LogID.ToString(); }
public void EmitLog(LogEntry log) { WriteEventLog(m_LogName, log.SerializationWithoutException(), EventLogEntryType.Error); }
public void EmitLog(LogEntry log) { SoapEntityMapping.Add <LogEntry>(); SoapEntityMapping.Add <ExtendedPropertyData>(); SoapClient.InvokeAsync(m_Url, m_MethodName, null, ex => { string message = string.Format("Write log failed.\r\n\r\n Error Info: {0}. \r\n\r\n Log Type: {1}. \r\n\r\n Log Info: {2}", ex.ToString(), this.GetType().AssemblyQualifiedName, log.SerializationWithoutException()); Logger.WriteEventLog(message, System.Diagnostics.EventLogEntryType.Error); }, log); }
private static string WriteLog(LogEntry log) { List <ILogEmitter> logEmitterList; try { logEmitterList = EmitterFactory.Create(); } catch (Exception ex) { string message = string.Format("Failed to create log emitter instance.\r\n\r\n Error Info: {0}. \r\n\r\n Log Info: {1}", ex.ToString(), log.SerializationWithoutException()); WriteEventLog(message, EventLogEntryType.Error); return(log.LogID.ToString()); } return(WriteLog(log, logEmitterList)); }
private static string WriteLog(LogEntry log, List <ILogEmitter> logEmitterList) { if (logEmitterList == null || logEmitterList.Count <= 0) { return(log.LogID.ToString()); } try { foreach (var logEmitter in logEmitterList) { if (logEmitter == null) { continue; } try { logEmitter.EmitLog(log); } catch (Exception ex) { string message = string.Format("Write log failed.\r\n\r\n Error Info: {0}. \r\n\r\n Log Type: {1}. \r\n\r\n Log Info: {2}", ex.ToString(), logEmitter.GetType().AssemblyQualifiedName, log.SerializationWithoutException()); Logger.WriteEventLog(message, EventLogEntryType.Error); } } } catch (Exception ex) { string message = string.Format("Write log failed.\r\n\r\n Error Info: {0}. \r\n\r\n Log Info: {1}", ex.ToString(), log.SerializationWithoutException()); Logger.WriteEventLog(message, EventLogEntryType.Error); } return(log.LogID.ToString()); }