Remove TC_* defines.
This commit is contained in:
parent
9ad1b3b49a
commit
f72195baab
@ -197,16 +197,8 @@ class CliLog : public LogInterface {
|
|||||||
reactivate_readline();
|
reactivate_readline();
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
if (log_level == VERBOSITY_NAME(PLAIN)) {
|
|
||||||
#if TD_WINDOWS
|
|
||||||
TsCerr() << slice;
|
|
||||||
#else
|
|
||||||
TsCerr() << TC_GREEN << slice << TC_EMPTY;
|
|
||||||
#endif
|
|
||||||
} else {
|
|
||||||
default_log_interface->do_append(log_level, slice);
|
default_log_interface->do_append(log_level, slice);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static CombinedLog combined_log;
|
static CombinedLog combined_log;
|
||||||
|
@ -264,19 +264,20 @@ class DefaultLog : public LogInterface {
|
|||||||
switch (log_level) {
|
switch (log_level) {
|
||||||
case VERBOSITY_NAME(FATAL):
|
case VERBOSITY_NAME(FATAL):
|
||||||
case VERBOSITY_NAME(ERROR):
|
case VERBOSITY_NAME(ERROR):
|
||||||
color = Slice(TC_RED);
|
color = Slice("\x1b[1;31m"); // red
|
||||||
break;
|
break;
|
||||||
case VERBOSITY_NAME(WARNING):
|
case VERBOSITY_NAME(WARNING):
|
||||||
color = Slice(TC_YELLOW);
|
color = Slice("\x1b[1;33m"); // yellow
|
||||||
break;
|
break;
|
||||||
case VERBOSITY_NAME(INFO):
|
case VERBOSITY_NAME(INFO):
|
||||||
color = Slice(TC_CYAN);
|
color = Slice("\x1b[1;36m"); // cyan
|
||||||
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) << TC_EMPTY "\n";
|
TsCerr() << color << slice.substr(0, slice.size() - 1) << no_color << "\n";
|
||||||
} else {
|
} else {
|
||||||
TsCerr() << color << slice << TC_EMPTY;
|
TsCerr() << color << slice << no_color;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
// TODO: color
|
// TODO: color
|
||||||
|
@ -190,13 +190,6 @@ extern LogInterface *log_interface;
|
|||||||
using OnLogMessageCallback = void (*)(int verbosity_level, CSlice message);
|
using OnLogMessageCallback = void (*)(int verbosity_level, CSlice message);
|
||||||
void set_log_message_callback(int max_verbosity_level, OnLogMessageCallback callback);
|
void set_log_message_callback(int max_verbosity_level, OnLogMessageCallback callback);
|
||||||
|
|
||||||
#define TC_RED "\x1b[1;31m"
|
|
||||||
#define TC_BLUE "\x1b[1;34m"
|
|
||||||
#define TC_CYAN "\x1b[1;36m"
|
|
||||||
#define TC_GREEN "\x1b[1;32m"
|
|
||||||
#define TC_YELLOW "\x1b[1;33m"
|
|
||||||
#define TC_EMPTY "\x1b[0m"
|
|
||||||
|
|
||||||
class TsCerr {
|
class TsCerr {
|
||||||
public:
|
public:
|
||||||
TsCerr();
|
TsCerr();
|
||||||
|
Loading…
Reference in New Issue
Block a user