コード例 #1
0
 public void Write(LogEntry entry)
 {
     if (!this.IsEnabled || this.Level > entry.Level || entry == null)
     {
         return;
     }
     Writer.WriteLine(entry.ToString());
 }
コード例 #2
0
 /// <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();
     }
 }
コード例 #3
0
 /// <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();
 }
コード例 #4
0
 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());
 }
コード例 #5
0
 public void Write(LogEntry entry)
 {
     if (!this.IsEnabled || this.Level > entry.Level || entry == null) return;
     Writer.WriteLine(entry.ToString());
 }
コード例 #6
0
        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());
        }