Color output currently broken, see notes.

This commit is contained in:
2024-06-28 14:09:31 -04:00
parent e0355d2a32
commit 99c1fe9f4c

View File

@@ -1,5 +1,3 @@
#include <jlog/jlog.hpp>
#include <string>
@@ -11,20 +9,28 @@ namespace jlog
{
// No fucking clue if this will work properly. Don't have a windows machine to test on right now.
// - Maxine
// No for a number of reasons
// 1. It didn't put delimiter characters down correctly
// 2. calling SetConsoleTextColor here won't work properly because we aren't *outputting* the content here
// 3. Additionally, we can't set the console color back to defaults after returning a value.
// This is a well-intentioned abstraction, but without a full grasp of the implications, and therefore won't work without considerable redesign.
std::string consoleMsgFormatter(token t)
{
std::string ft;
if (!t.delimiter.empty())
{
SetConsoleTextColor(t.colorCode.nt_code);
ft = std::string(1, t.delimiter[0]) + t.content + std::string(1, t.delimiter[1]) + " ";
// TODO: some ability to let user handle space-separation if they do/don't want it
return std::format("{}{}{} ", t.delimiter[0], t.content, t.delimiter[1]);
SetConsoleTextColor(color_codes::FG_DEFAULT.nt_code);
}
SetConsoleTextColor(t.colorCode.nt_code);
ft = t.content + " ";
return t.content;
SetConsoleTextColor(color_codes::FG_DEFAULT.nt_code);
return ft;
}
std::string logfileMsgFormatter(token t)