-
-
Notifications
You must be signed in to change notification settings - Fork 937
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can you add support for colored output to console? #408
Comments
You can use the add a helper-method like this somewhere in your code // Colors for output
#define RESET "\033[0m"
#define RED "\033[31m"
#define ORANGE "\033[33m"
#define GRAY "\033[90m"
std::string make_coloured(std::string msg){
std::string prefix = msg.substr(0, 7);
if(prefix == "[ERROR]"){
msg = RED + msg + RESET;
} else if(prefix == "[WARN ]"){
msg = ORANGE + msg + RESET;
} else if(prefix == "[TRACE]"){
msg = GRAY + msg + RESET;
}
return msg;
} and then before you I had some more options to set before the #ifndef CUSTOM_EASYLOGGING_H
#define CUSTOM_EASYLOGGING_H
// declare my custom output method
std::string make_coloured(std::string msg);
// easylogging options
#define ELPP_CUSTOM_COUT_LINE(msg) make_coloured(msg)
#define ELPP_DISABLE_DEFAULT_CRASH_HANDLING
// include actual easylogging
#include "easylogging++.h"
// initialize
INITIALIZE_EASYLOGGINGPP
#endif //CUSTOM_EASYLOGGING_H |
Version 9.26 introduced inbuilt support for this via the I opened a PR to improve the compatibility on Windows: #843 |
Linux shell and Windows10 console output can be colorized in a standard way. Can you add support and configurability for this?
The text was updated successfully, but these errors were encountered: