public static async Task AppendOutputTextAsync(string logEntry)
 {
     await Application.Current.Dispatcher.InvokeAsync(() =>
     {
         Instance.OutputText.AppendText(logEntry, LoggerColor.LogEntryColor(logEntry));
         ////Instance.OutputText.ScrollToEnd();
     });
 }
Example #2
0
    public static string AddColor(string word, LoggerColor color, bool bold = false)
    {
        var formatStr = string.Format("<color={0}>{1}</color>", color, word);

        if (bold)
        {
            formatStr = "<b>" + formatStr + "</b>";
        }
        return(formatStr);
    }
Example #3
0
        public static void Test(object message, LoggerColor color = LoggerColor.Green)
        {
            ConsoleColor consoleColor = ConsoleColor.Green;

            switch (color)
            {
            case LoggerColor.Red:
                consoleColor = ConsoleColor.Red;
                break;

            case LoggerColor.Green:
                consoleColor = ConsoleColor.Green;
                break;

            case LoggerColor.Blue:
                consoleColor = ConsoleColor.Blue;
                break;

            case LoggerColor.Black:
                consoleColor = ConsoleColor.Black;
                break;

            case LoggerColor.White:
                consoleColor = ConsoleColor.White;
                break;

            case LoggerColor.Cyan:
                consoleColor = ConsoleColor.Cyan;
                break;

            case LoggerColor.Magenta:
                consoleColor = ConsoleColor.Magenta;
                break;

            case LoggerColor.Yellow:
                consoleColor = ConsoleColor.Yellow;
                break;

            default:
                break;
            }
            Console.ForegroundColor = consoleColor;
            Console.WriteLine($"TESTS: {message}");
        }
Example #4
0
 public void Log(string value, LoggerColor color)
 {
     lock (Console.Out)
     {
         Console.Write($"[{DateTime.Now.ToString("HH:mm:ss")}]");
         if (_Display != null)
             Console.Write($"[{_Display}]");
         Console.Write(" ");
         if (color != LoggerColor.Default)
         {
             switch (color)
             {
                 case LoggerColor.Black:
                     Console.ForegroundColor = ConsoleColor.Black;
                     break;
                 case LoggerColor.DarkBlue:
                     Console.ForegroundColor = ConsoleColor.DarkBlue;
                     break;
                 case LoggerColor.DarkGreen:
                     Console.ForegroundColor = ConsoleColor.DarkGreen;
                     break;
                 case LoggerColor.DarkCyan:
                     Console.ForegroundColor = ConsoleColor.DarkCyan;
                     break;
                 case LoggerColor.DarkRed:
                     Console.ForegroundColor = ConsoleColor.DarkRed;
                     break;
                 case LoggerColor.DarkMagenta:
                     Console.ForegroundColor = ConsoleColor.DarkMagenta;
                     break;
                 case LoggerColor.DarkYellow:
                     Console.ForegroundColor = ConsoleColor.DarkYellow;
                     break;
                 case LoggerColor.Gray:
                     Console.ForegroundColor = ConsoleColor.Gray;
                     break;
                 case LoggerColor.DarkGray:
                     Console.ForegroundColor = ConsoleColor.DarkGray;
                     break;
                 case LoggerColor.Blue:
                     Console.ForegroundColor = ConsoleColor.Blue;
                     break;
                 case LoggerColor.Green:
                     Console.ForegroundColor = ConsoleColor.Green;
                     break;
                 case LoggerColor.Cyan:
                     Console.ForegroundColor = ConsoleColor.Cyan;
                     break;
                 case LoggerColor.Red:
                     Console.ForegroundColor = ConsoleColor.Red;
                     break;
                 case LoggerColor.Magenta:
                     Console.ForegroundColor = ConsoleColor.Magenta;
                     break;
                 case LoggerColor.Yellow:
                     Console.ForegroundColor = ConsoleColor.Yellow;
                     break;
                 case LoggerColor.White:
                     Console.ForegroundColor = ConsoleColor.White;
                     break;
             }
             Console.WriteLine(value);
             Console.ResetColor();
         }
         else
             Console.WriteLine(value);
     }
 }
Example #5
0
 public static void LogError(object log, LoggerColor color)
 {
     logger.LogError("ERROR", string.Format("<Color=#{0}>{1}</color>", ((int)color).ToString("X6"), log));
 }
Example #6
0
 public static void LogWarning(object log, LoggerColor color)
 {
     logger.LogWarning("WARNING", string.Format("<Color=#{0}>{1}</color>", ((int)color).ToString("X6"), log));
 }
Example #7
0
 public static void LogWithBlackets(object log, LoggerColor color)
 {
     logger.Log(string.Format("<b><Color=#{0}>【{1}】</color></b>", ((int)color).ToString("X6"), log));
 }