public LogListItem(object eventSource, LogEventArg eventArg) { this.EventDate = DateTime.Now; this.EventSource = eventSource; base.Level = eventArg.Level; base.Title = eventArg.Title; base.Message = eventArg.Message; base.ShowAs = eventArg.ShowAs; }
private void ApppendLogsTo(string logFileName, LogEventArg e) { if (logFileName.IsBlank()) return; switch (e.Level) { case L4j.Off: // case L4j.Debug: // ignore these levels case L4j.Trace: return; // } if (e.ShowAs != ShowLogAs.Normal) return; if (_logFile == null) _logFile = _fs.File(_fs.GetAssemblyDir().Bslash(logFileName)); var line = L.f + TextLog.Format(e.Title, e.Message); _logFile.Write(line, EncodeAs.UTF8, false, false); }
private bool Arg(L4j level, ShowLogAs showAs, string title, string message) { if (level == L4j.Off) { return(false); } var e = new LogEventArg { Level = level, ShowAs = showAs, Title = title, Message = message }; try { _logAdded?.Invoke(this, e); } catch { } return(e.Level.Polarity()); }
public string RewriteToInclude(LogEventArg e) { switch (e.ShowAs) { case ShowLogAs.Normal: return(AppendNormal(e.Level, e.Title, e.Message)); case ShowLogAs.Header: return(AppendHeader(e.Level, e.Title, e.Message)); case ShowLogAs.Intro: return(AppendIntro(e.Level, e.Title)); case ShowLogAs.Outro: return(AppendOutro(e.Level, e.Message)); default: throw Error.Unsupported(e.ShowAs); } }
public string RewriteToInclude(LogEventArg e) { switch (e.ShowAs) { case ShowLogAs.Normal: return AppendNormal(e.Level, e.Title, e.Message); case ShowLogAs.Header: return AppendHeader(e.Level, e.Title, e.Message); case ShowLogAs.Intro: return AppendIntro(e.Level, e.Title); case ShowLogAs.Outro: return AppendOutro(e.Level, e.Message); default: throw Error.Unsupported(e.ShowAs); } }
public void ShowLog(object src, LogEventArg e) { if (Fired(e)) return; switch (e.ShowAs) { case ShowLogAs.Header: this.LogHeader(e.Level, e.Title, e.Message); break; case ShowLogAs.Intro: this.LogIntro(e.Level, e.Title); break; case ShowLogAs.Outro: this.LogOutro(e.Level, e.Message); break; default: this.LogNormal(e.Level, e.Title, e.Message); break; } }
public static string Format(LogEventArg e, int maxCol1Width = 40) { return(e.Title.AlignLeft(maxCol1Width) + " : " + e.Message); }
//public void LogNormal(L4j level, string col1, string col2) // => _cons.LogNormal(level, col1, col2); public void ShowLog(object src, LogEventArg e) => _cons.ShowLog(src, e);
public static string Format(LogEventArg e, int maxCol1Width = 40) { return e.Title.AlignLeft(maxCol1Width) + " : " + e.Message; }
//public void ScrollToEnd() => cons.ScrollToEnd(); private static bool Fired(LogEventArg e, object o = null) { if (_evtHistory.TryGetValue(e, out o)) return true; _evtHistory.Add(e, null); return false; }