Got logging and errors basically all working the way I want

This commit is contained in:
NaifBanana
2026-06-11 04:24:06 -05:00
parent 0f62aecfa3
commit 58121bdf28
10 changed files with 465 additions and 291 deletions
+13 -3
View File
@@ -10,11 +10,21 @@ nb::DefaultDebugLogger logger(std::cout);
#endif // _NB_NO_LOGGER
bool nb::DefaultDebugLogger::process(const LogEvent& msg) {
constexpr size_t level_field_width = 3;
constexpr size_t msg_prompt_length = level_field_width+6;
for (const auto os : this->_ostream) {
*os << "[";
os->width(level_field_width);
(*os << std::to_string(msg.lvl)).width(level_field_width);
*os << "] :: ";
std::string fileloc="";
if (!msg.file.empty()) {
fileloc += "(" + msg.file + ":" + std::to_string(msg.line) + ") - ";
}
*os << indent_strblock(
msg.msg,
std::string(10, ' '),
"[ "+std::to_string(msg.lvl)+" ] : "
fileloc + msg.msg,
std::string(15 - msg_prompt_length, ' '),
""
) << nb::NEWLINE;
}
return true;