Exemplo n.º 1
0
 /// <summary>
 /// Logs an entry to the Logger instance.
 /// </summary>
 /// <param name="level">The level of the entry.</param>
 /// <param name="entry">The textual value of the entry.</param>
 public virtual void Log(LogLevel level, object entry)
 {
     if ((DisplayedLevels & level) != LogLevel.None)
     {
         lock (logLockObj)
         {
             EntryLogged?.Invoke(level, entry);
             WriteLine($"[{level.GetHighestLevel()}] {entry}");
         }
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Logs an entry to the Logger instance.
        /// </summary>
        /// <param name="level">The level of the entry.</param>
        /// <param name="entry">The textual value of the entry.</param>
        public override void Log(LogLevel level, object entry)
        {
            Kon.ForegroundColor = level.GetConsoleColor();
            base.Log(level, entry);
            Kon.ForegroundColor = ConsoleColor.Gray;

            // If the display level got ignored, still write it to the log
            if ((DisplayedLevels & level) == LogLevel.None)
            {
                WriteToLog($"[{level.GetHighestLevel()}] {entry}\r\n");
            }
        }