Browse Source

Fix colored console printer to correctly handle multiline darkened messages

pull/86/head
Anairkoen Schno 2 years ago
parent
commit
d9982f98e6
No known key found for this signature in database GPG Key ID: 40F6F33603F1772D
1 changed files with 8 additions and 2 deletions
  1. +8
    -2
      IPA.Loader/Logging/Printers/ColoredConsolePrinter.cs

+ 8
- 2
IPA.Loader/Logging/Printers/ColoredConsolePrinter.cs View File

@ -66,13 +66,19 @@ namespace IPA.Logging.Printers
SetColor(Color, WinConsole.OutHandle); SetColor(Color, WinConsole.OutHandle);
var prefixStr = ""; var prefixStr = "";
var suffixStr = "";
if ((darkenSetManually && darkenMessages) || (!darkenSetManually && Config.SelfConfig.Debug_.DarkenMessages_)) if ((darkenSetManually && darkenMessages) || (!darkenSetManually && Config.SelfConfig.Debug_.DarkenMessages_))
{ {
prefixStr = StdoutInterceptor.ConsoleColorToForegroundSet(GetDarkenedColor(Color));
var darkened = GetDarkenedColor(Color);
if (darkened != Color)
{
prefixStr = StdoutInterceptor.ConsoleColorToForegroundSet(darkened);
suffixStr = StdoutInterceptor.ConsoleColorToForegroundSet(Color);
}
} }
foreach (var line in message.Split(new[] { "\n", Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)) foreach (var line in message.Split(new[] { "\n", Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries))
WinConsole.ConOut.WriteLine(Logger.LogFormat, prefixStr + line, logName, time, level.ToString().ToUpperInvariant());
WinConsole.ConOut.WriteLine(Logger.LogFormat, prefixStr + line + suffixStr, logName, time, level.ToString().ToUpperInvariant());
ResetColor(WinConsole.OutHandle); ResetColor(WinConsole.OutHandle);
} }


Loading…
Cancel
Save