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);
     });
 }
Beispiel #2
0
 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);
 }
Beispiel #3
0
        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"));
        }
Beispiel #4
0
        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"));
        }
Beispiel #5
0
 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);
 }
Beispiel #6
0
        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);
 }
Beispiel #8
0
 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)
 {
     WriteEventLog(m_LogName, log.SerializationWithoutException(), EventLogEntryType.Error);
 }
Beispiel #10
0
        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));
        }
Beispiel #11
0
        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());
        }
Beispiel #12
0
        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);
            });
        }