Output no_color only if there was a color.
This commit is contained in:
parent
00cea653bf
commit
96382d5621
@ -208,6 +208,7 @@ class DefaultLog final : public LogInterface {
|
|||||||
}
|
}
|
||||||
#elif !TD_WINDOWS
|
#elif !TD_WINDOWS
|
||||||
Slice color;
|
Slice color;
|
||||||
|
Slice no_color("\x1b[0m");
|
||||||
switch (log_level) {
|
switch (log_level) {
|
||||||
case VERBOSITY_NAME(FATAL):
|
case VERBOSITY_NAME(FATAL):
|
||||||
case VERBOSITY_NAME(ERROR):
|
case VERBOSITY_NAME(ERROR):
|
||||||
@ -220,10 +221,9 @@ class DefaultLog final : public LogInterface {
|
|||||||
color = Slice("\x1b[1;36m"); // cyan
|
color = Slice("\x1b[1;36m"); // cyan
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// no color
|
no_color = Slice();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Slice no_color("\x1b[0m");
|
|
||||||
if (!slice.empty() && slice.back() == '\n') {
|
if (!slice.empty() && slice.back() == '\n') {
|
||||||
TsCerr() << color << slice.substr(0, slice.size() - 1) << no_color << "\n";
|
TsCerr() << color << slice.substr(0, slice.size() - 1) << no_color << "\n";
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user