global-functions: $LogPrintExit: make colorful output configurable

This commit is contained in:
Christian Hesse 2021-01-22 09:20:49 +01:00
parent bbf918e329
commit b780b40baf
2 changed files with 8 additions and 0 deletions

View file

@ -35,6 +35,8 @@
# Toggle this to disable symbols in notifications.
:global NotificationsWithSymbols true;
# Toggle this to disable color output in terminal/cli.
:global TerminalColorOutput true;
# This defines what backups to generate and what password to use.
:global BackupSendBinary false;

View file

@ -413,6 +413,12 @@
:global PrintDebug;
:local PrintSeverity do={
:global TerminalColorOutput;
:if ($TerminalColorOutput != true) do={
:return $1;
}
:local Color { debug=96; info=97; warning=93; error=91 };
:return ("\1B[" . $Color->$1 . "m" . $1 . "\1B[0m");
}