public override void AddEntry(LogEntry entry) { LogItems.Add(entry); LogEntries.Add(entry.ToString()); if (_fileError || Configuration.FullPath == string.Empty) return; try { using (var writer = File.AppendText(Configuration.FullPath)) { writer.WriteLine(Strings.FileLogEntryFormat, entry.TimeStamp, entry.Level.ToString().ToUpper(), entry.Message); if (entry.HasException) { Writer.WriteException(entry.Exception, writer); } } } catch (Exception ex) { _fileError = true; AddEntry(LogLevel.Error, ex, ex.Message); } }
public override void AddEntry(LogEntry entry) { LogItems.Add(entry); LogEntries.Add(entry.ToString()); try { System.Console.WriteLine(Strings.FileLogEntryFormat, entry.TimeStamp, entry.Level.ToString().ToUpper(), entry.Message); if (entry.HasException) { Writer.WriteException(entry.Exception, System.Console.Out); } } catch (Exception ex) { AddEntry(LogLevel.Error, ex, ex.Message); } }
public override void AddEntry(LogEntry entry) { LogItems.Add(entry); LogEntries.Add(entry.ToString()); try { System.Diagnostics.Trace.WriteLine( string.Format(Strings.TraceLogEntryFormat, entry.TimeStamp, entry.Level.ToString().ToUpper(), entry.Message)); if (entry.HasException) { Writer.WriteException(entry.Exception, System.Diagnostics.Trace.Listeners); } } catch (Exception ex) { AddEntry(LogLevel.Error, ex, ex.Message); } }
public abstract void AddEntry(LogEntry entry);