Open Lunar-Eclipse255 opened 1 month ago
Here are some color codes (from my comp v5 program, but this will only work on a terminal)
/// @brief *For loghandler*
/// @param str takes Log::Level level
/// @return Color code of Log::Level in string.
const char *LogToColor(const Log::Level &str)
{
switch (str)
{
case Log::Level::Trace:
{
return "\033[92m[Trace]";
}
case Log::Level::Debug:
{
return "\033[93m[Debug]";
}
case Log::Level::Info:
{
return "\033[94m[Info]";
}
case Log::Level::Warn:
{
return " \033[38;5;216m[Warn]";
}
case Log::Level::Error:
{
return "\033[31m[Error]";
}
case Log::Level::Fatal:
{
return "\033[32m[Fatal]";
}
default:
{
return "\033[31m[Error]";
}
}
}
Just created a new branch called rtf_color_messages, to work on this to not disturb the main branch, and when the switch to rtf is done it can be merged
Some boiler?
std::ofstream LogFile("log.rtf", std::ios_base::out | std::ios_base::app);
if (confighere_withertoaddtofile)
{
if (!LogFile)
{
logHandler("logHandler", "Could not create logfile.", Log::Level::Warn, 3);
ConfigManager.setLogToFile(false);
}
LogFile << "[" << LogToString(level) << "] > Time: " << Brain.Timer.time(vex::timeUnits::sec) << " > Module: " << functionName << " > " << message << "\n";
}
Is this working in the new branch?
Yes but nothing is formatted properly yet, but the coloring does work. I've just been quite busy these past weeks
All good! Just a checkup :)
Colored messages should also have the corresponding level to them, or a custom color of user choice? Ex in green: [Trace] test1 ex in red: [Error] very bad error