Пример #1
0
        //... public Log methods

        private static void Log(LogRecord loggingRecord)
        {
            try
            {
                lock (_staticSyncRoot)
                {
                    if (LoggingEnabled)
                    {
                        if (IsAsynchroneous)
                        {
                            _loggingThread.AddWork(loggingRecord);
                        }
                        else
                        {
                            if (LogWriter != null)
                            {
                                LogWriter.Write(loggingRecord);
                                LogWriter.Flush();
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                FallbackLogging(loggingRecord, ex);
            }
        }
Пример #2
0
 public static void FallbackLogging(LogRecord loggingRecord, Exception ex)
 {
     try
     {
         if (ex != null)
         {
             Debug.WriteLine("Logging failure : " + ex.ToString());
         }
     }
     catch
     { }
 }
Пример #3
0
 private static void WhenLogHandlerDo(LogRecord record)
 {
     if (LogWriter != null)
         LogWriter.Write(record);
 }
Пример #4
0
 public LogRecord Extend()
 {
     var extension = new LogRecord();
     extension.Identifier = this.Identifier;
     return extension;
 }