feat: Add a flag to disable colors in logs
This commit is contained in:
parent
f64d9050de
commit
04e9ae522d
|
|
@ -40,6 +40,7 @@ class Logs {
|
||||||
}
|
}
|
||||||
|
|
||||||
Level level = Level.info;
|
Level level = Level.info;
|
||||||
|
bool nativeColors = true;
|
||||||
|
|
||||||
final List<LogEvent> outputEvents = [];
|
final List<LogEvent> outputEvents = [];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ extension PrintLogs on LogEvent {
|
||||||
if (stackTrace != null) {
|
if (stackTrace != null) {
|
||||||
logsStr += '\n${stackTrace.toString()}';
|
logsStr += '\n${stackTrace.toString()}';
|
||||||
}
|
}
|
||||||
|
if (Logs().nativeColors) {
|
||||||
switch (level) {
|
switch (level) {
|
||||||
case Level.wtf:
|
case Level.wtf:
|
||||||
logsStr = '\x1B[31m!!!CRITICAL!!! $logsStr\x1B[0m';
|
logsStr = '\x1B[31m!!!CRITICAL!!! $logsStr\x1B[0m';
|
||||||
|
|
@ -28,6 +29,7 @@ extension PrintLogs on LogEvent {
|
||||||
case Level.verbose:
|
case Level.verbose:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// ignore: avoid_print
|
// ignore: avoid_print
|
||||||
print('[Matrix] $logsStr');
|
print('[Matrix] $logsStr');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue