public void Log(string owner, string message, LogItemLevel level = LogItemLevel.Normal) { if (string.IsNullOrWhiteSpace(owner)) { Console.WriteLine(message); } else { Console.WriteLine($"{owner}: {message}"); } }
public static string GetPrefix(this LogItemLevel level) { switch (level) { case Trace: return("[TRACE]"); case Debug: return("[DEBUG]"); case Information: return("[INFO.]"); case Warning: return("[WARN.]"); case Error: return("[ERROR]"); case Fatal: return("[FATAL]"); } return("[?????]"); }
public static string GetFixedLabel(this LogItemLevel level) { switch (level) { case Trace: return("TRACE"); case Debug: return("DEBUG"); case Information: return("INFO."); case Warning: return("WARN."); case Error: return("ERROR"); case Fatal: return("FATAL"); } return("?????"); }
public LogItem(object data, LogItemLevel level = DefaultItemLevel) : this(data, null) { }
public LogItem(object data, object category, LogItemLevel level = DefaultItemLevel) { Category = category; Data = data; Level = level; }
public static bool ShouldSkip(this LoggingLevel logging, LogItemLevel logItem) => (int)logging > (int)logItem;
public static void Log(this Subject<LogItem> subject, object data, LogItemLevel level = DefaultItemLevel) => subject.Log(data, null, level);
public static void Log(this Subject<LogItem> subject, object data, object category, LogItemLevel level = DefaultItemLevel) => subject.Log(new LogItem(data, category, level));
public void Log(string owner, string message, LogItemLevel level = LogItemLevel.Normal) { _messages.Add(new LogItem(owner, message, level)); }
public static void Log(this Subject <LogItem> subject, object data, LogItemLevel level = DefaultItemLevel) => subject.Log(data, null, level);
public static void Log(this Subject <LogItem> subject, object data, object category, LogItemLevel level = DefaultItemLevel) => subject.Log(new LogItem(data, category, level));
public LogItem(string owner, string message, LogItemLevel level) { Owner = owner; Message = message; Level = level; }