Remove TC_* defines.

This commit is contained in:
levlam 2021-05-18 16:55:35 +03:00
parent 9ad1b3b49a
commit f72195baab
3 changed files with 7 additions and 21 deletions

View File

@ -197,15 +197,7 @@ class CliLog : public LogInterface {
reactivate_readline();
};
#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);
}
};

View File

@ -264,19 +264,20 @@ class DefaultLog : public LogInterface {
switch (log_level) {
case VERBOSITY_NAME(FATAL):
case VERBOSITY_NAME(ERROR):
color = Slice(TC_RED);
color = Slice("\x1b[1;31m"); // red
break;
case VERBOSITY_NAME(WARNING):
color = Slice(TC_YELLOW);
color = Slice("\x1b[1;33m"); // yellow
break;
case VERBOSITY_NAME(INFO):
color = Slice(TC_CYAN);
color = Slice("\x1b[1;36m"); // cyan
break;
}
Slice no_color("\x1b[0m");
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 {
TsCerr() << color << slice << TC_EMPTY;
TsCerr() << color << slice << no_color;
}
#else
// TODO: color

View File

@ -190,13 +190,6 @@ extern LogInterface *log_interface;
using OnLogMessageCallback = void (*)(int verbosity_level, CSlice message);
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 {
public:
TsCerr();