public override void LogMessage(LogMessageRecord rec) { if (rec.Level >= MinLogLevel) { if (OnMessage != null) { OnMessage(this, new LogMessageEventArgs { LogRecord = rec }); } lock (m_cache) { while (m_cacheSize != null && m_cache.Count >= m_cacheSize) { m_cache.RemoveAt(0); } m_cache.Add(rec); } } }
public LogMessageRecord SeekRecord(LogMessageRecord current, SeekOrigin origin, int pos, bool fixEdge) { lock (m_cache) { int curpos = m_cache.IndexOf(current); int index = -1; switch (origin) { case SeekOrigin.Begin: index = pos; break; case SeekOrigin.Current: index = curpos + pos; break; case SeekOrigin.End: index = m_cache.Count - 1 - pos; break; } if (fixEdge) { if (index >= m_cache.Count) { index = m_cache.Count - 1; } if (index < 0) { index = 0; } } if (index >= 0 && index < m_cache.Count) { return(m_cache[index]); } return(null); } }
private void AddLogMessage(LogMessageRecord msg) { if (IsTargetList) { if (m_source.Capacity != null) { while (lvMessages.Items.Count > m_source.Capacity) { lvMessages.Items.RemoveAt(0); } } ListViewItem added = lvMessages.Items.Add(Texts.Get(msg.Level.GetTitle()), m_imgCache.GetImageIndex(msg.Level.GetImage())); added.SubItems.Add(Texts.Get(msg.Category)); added.SubItems.Add(msg.Message); added.Tag = msg; if (btnAutoScroll.Checked) { added.EnsureVisible(); } } if (IsTargetTrace) { codeEditor1.ReadOnly = false; codeEditor1.Document.Insert(codeEditor1.Document.TextLength, msg.Message); codeEditor1.Document.Insert(codeEditor1.Document.TextLength, "\n"); if (btnAutoScroll.Checked) { codeEditor1.ActiveTextAreaControl.Caret.Line = codeEditor1.Document.LineSegmentCollection.Count - 1; } codeEditor1.ReadOnly = true; m_traceCount++; if (m_source.Capacity != null && m_traceCount > m_source.Capacity * 2) { FillMessages(); } } }
public void LogMessage(LogMessageRecord msg) { m_logger.LogMessage(msg); }
public void LogMessage(LogMessageRecord msg) { m_logCache.LogMessage(msg); Logging.LogMessage(msg); m_reportEnv.LogMessage(msg); }
public override void LogMessage(LogMessageRecord message) { }
public override void LogMessage(LogMessageRecord rec) { Console.Error.WriteLine("{0}: {1}", rec.Level, rec.Message); }
public override void LogMessage(LogMessageRecord message) { m_queue.Put(message); }
public abstract void LogMessage(LogMessageRecord message);
//public static Color LevelColor(LogLevel level) //{ // switch (level) // { // case LogLevel.Trace: // return Color.Aqua; // case LogLevel.Debug: // return Color.Lime; // case LogLevel.Info: // return Color.White; // case LogLevel.Warning: // return Color.Yellow; // case LogLevel.Error: // return Color.Red; // case LogLevel.Fatal: // return Color.Magenta; // } // return Color.White; //} //public static void LogMessage(LogMessageRecord rec) //{ // if (rec.Level >= LogLevel.Debug) // { // // dont cache traces... // lock (m_lastRecords) // { // while (m_lastRecords.Count >= CACHE_SIZE) m_lastRecords.RemoveAt(0); // m_lastRecords.Add(rec); // } // if (!Core.IsGUI) Console.Error.WriteLine("{0}: {1}", rec.Level, rec.Message); // } // m_queue.Put(rec); //} public static void LogMessage(LogMessageRecord rec) { Root.LogMessage(rec); }
public static void LogMessage(this ILogger logger, LogLevel level, string message) { LogMessageRecord rec = new LogMessageRecord(level, message); (logger ?? Logging.Root).LogMessage(rec); }
public static void LogMessageEx(this ILogger logger, LogMessageRecord rec) { (logger ?? Logging.Root).LogMessage(rec); }