Esempio n. 1
0
 public void Log(string owner, string message, LogItemLevel level = LogItemLevel.Normal)
 {
     if (string.IsNullOrWhiteSpace(owner))
     {
         Console.WriteLine(message);
     }
     else
     {
         Console.WriteLine($"{owner}: {message}");
     }
 }
Esempio n. 2
0
        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("[?????]");
        }
Esempio n. 3
0
        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("?????");
        }
Esempio n. 4
0
 public LogItem(object data, LogItemLevel level = DefaultItemLevel)
     : this(data, null)
 { }
Esempio n. 5
0
 public LogItem(object data, object category, LogItemLevel level = DefaultItemLevel)
 {
     Category = category;
     Data = data;
     Level = level;
 }
Esempio n. 6
0
 public LogItem(object data, LogItemLevel level = DefaultItemLevel)
     : this(data, null)
 {
 }
Esempio n. 7
0
 public LogItem(object data, object category, LogItemLevel level = DefaultItemLevel)
 {
     Category = category;
     Data     = data;
     Level    = level;
 }
Esempio n. 8
0
 public static bool ShouldSkip(this LoggingLevel logging, LogItemLevel logItem)
     => (int)logging > (int)logItem;
Esempio n. 9
0
 public static void Log(this Subject<LogItem> subject, object data, LogItemLevel level = DefaultItemLevel)
     => subject.Log(data, null, level);
Esempio n. 10
0
 public static void Log(this Subject<LogItem> subject, object data, object category, LogItemLevel level = DefaultItemLevel)
     => subject.Log(new LogItem(data, category, level));
Esempio n. 11
0
 public static bool ShouldSkip(this LoggingLevel logging, LogItemLevel logItem)
 => (int)logging > (int)logItem;
Esempio n. 12
0
 public void Log(string owner, string message, LogItemLevel level = LogItemLevel.Normal)
 {
     _messages.Add(new LogItem(owner, message, level));
 }
Esempio n. 13
0
 public static void Log(this Subject <LogItem> subject, object data, LogItemLevel level = DefaultItemLevel)
 => subject.Log(data, null, level);
Esempio n. 14
0
 public static void Log(this Subject <LogItem> subject, object data, object category, LogItemLevel level = DefaultItemLevel)
 => subject.Log(new LogItem(data, category, level));
Esempio n. 15
0
 public LogItem(string owner, string message, LogItemLevel level)
 {
     Owner   = owner;
     Message = message;
     Level   = level;
 }