public void Write(LoggerItem item) { //remove the BELL symbol (according to ASCII) to stop the Windows console //triggers beeps when displaying binary data String message = item.Message.Replace('\x7', ' '); Console.WriteLine("{0}:{1}", item.Date, message); }
public void Show(LogLevel level, string format, params object[] args) { if (CheckLevel(level)) { LoggerItem item = new LoggerItem(level) { Modal = true, Message = String.Format(format, args), Category = this.Category }; Writer.Write(item); } }
public void Write(LoggerItem item) { ILogWriter[] writers; lock (this) { writers = Writers.ToArray(); } foreach (ILogWriter writer in writers) { writer.Write(item); } }
public void Write(LoggerItem item) { if (this.Dispatcher.CheckAccess()) { // The calling thread owns the dispatcher, and hence the UI element AddLoggerItem(item); } else { //invocation required this.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new LoggerItemDelegate(AddLoggerItem), item); } }
void ReportException(string message, Exception x, bool modal) { LoggerItem item = new LoggerItem(LogLevel.Error) { Modal = modal, Message = message, Category = this.Category, Details = Format.GetExceptionMessage(x) }; Writer.Write(item); }
public void Print(LogLevel level, string format, params object[] args) { if (CheckLevel(level)) { LoggerItem item = new LoggerItem(level) { Message = String.Format(format, args), Category = this.Category }; //System.Diagnostics.Debug.Print(item.Message); Writer.Write(item); } }
void AddLoggerItem(LoggerItem item) { if (loggerItems.Count > LogLimit) { //loggerItems.RemoveAt(loggerItems.Count - 1); int tail_len = loggerItems.Count - LogLimit; for (int i = 0; i < tail_len; ++i) { loggerItems.RemoveAt(LogLimit); } } loggerItems.Insert(0, item); if (item.Modal) { ShowMessage(item); } }
public void Write(LoggerItem item) { //it does nothing }