public void Write(LogEntry entry) { if (!this.IsEnabled || this.Level > entry.Level || entry == null) { return; } Writer.WriteLine(entry.ToString()); }
/// <summary> /// Writes the log entry to a medium. /// </summary> /// <param name="entry">The entry to log.</param> /// <param name="flush">A value indicating whether the writer should call Flush after writing to the TextWriter.</param> public void Write(LogEntry entry, bool flush) { if (!this.IsEnabled || this.Level > entry.Level || entry == null) { return; } Writer.WriteLine(entry.ToString(string.Empty, this.DateFormat)); if (flush || this.AutoflushLevel <= entry.Level) { Flush(); } }
/// <summary> /// Writes the log entry to a medium. /// </summary> /// <param name="entry">The entry to log.</param> /// <param name="flush">A value indicating whether the writer should call Flush after writing to the TextWriter.</param> public void Write(LogEntry entry, bool flush) { if (!this.IsEnabled || this.Level > entry.Level || entry == null) return; Writer.WriteLine(entry.ToString(string.Empty, "yyyy-MM-dd HH:mm:ss")); if (flush || this.AutoflushLevel <= entry.Level) Flush(); }
public void TestToString() { DateTime time = new DateTime(2009, 05, 31, 20, 5, 36); LogEntry entry = new LogEntry(time) { Message = "message", Level = LogLevel.Fatal }; Assert.AreEqual(string.Format("FATAL - {0} {1} - message", time.ToShortDateString(), time.ToShortTimeString()), entry.ToString()); }
public void Write(LogEntry entry) { if (!this.IsEnabled || this.Level > entry.Level || entry == null) return; Writer.WriteLine(entry.ToString()); }