WIP: Graphics Overhaul #2
@ -10,20 +10,19 @@ nb::DefaultDebugLogger logger(std::cout);
|
|||||||
#endif // _NB_NO_LOGGER
|
#endif // _NB_NO_LOGGER
|
||||||
|
|
||||||
bool nb::DefaultDebugLogger::process(const LogEvent& msg) {
|
bool nb::DefaultDebugLogger::process(const LogEvent& msg) {
|
||||||
constexpr size_t level_field_width = 3;
|
constexpr size_t level_field_width = 5;
|
||||||
constexpr size_t msg_prompt_length = level_field_width+6;
|
constexpr size_t msg_prompt_length = level_field_width+7;
|
||||||
for (const auto os : this->_ostream) {
|
for (const auto os : this->_ostream) {
|
||||||
*os << "[";
|
*os << "[";
|
||||||
os->width(level_field_width);
|
os->width(level_field_width);
|
||||||
(*os << std::to_string(msg.lvl)).width(level_field_width);
|
*os << std::to_string(msg.lvl) << "] :: ";
|
||||||
*os << "] :: ";
|
|
||||||
std::string fileloc="";
|
std::string fileloc="";
|
||||||
if (!msg.file.empty()) {
|
if (!msg.file.empty()) {
|
||||||
fileloc += "(" + msg.file + ":" + std::to_string(msg.line) + ") - ";
|
fileloc += "(" + msg.file + ":" + std::to_string(msg.line) + ") - ";
|
||||||
}
|
}
|
||||||
*os << indent_strblock(
|
*os << indent_strblock(
|
||||||
fileloc + msg.msg,
|
fileloc + msg.msg,
|
||||||
std::string(15 - msg_prompt_length, ' '),
|
std::string(20 - msg_prompt_length, ' '),
|
||||||
""
|
""
|
||||||
) << nb::NEWLINE;
|
) << nb::NEWLINE;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,8 +31,8 @@ const nb::ErrorCodeMap TestError::ErrorMessages{
|
|||||||
int main() {
|
int main() {
|
||||||
nb::logger.log("Whoop!");
|
nb::logger.log("Whoop!");
|
||||||
try {
|
try {
|
||||||
THROW(nb::Error(1));
|
THROW(TestError(0, TestError(1, TestError(2, TestError(3, TestError(2))))));
|
||||||
} catch (nb::Error<> e){
|
} catch (TestError e){
|
||||||
nb::logger.log("nb::Error was thrown!");
|
nb::logger.log("nb::Error was thrown!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,6 +41,6 @@ int main() {
|
|||||||
} catch (std::exception e){
|
} catch (std::exception e){
|
||||||
nb::logger.log("std::exception was thrown!");
|
nb::logger.log("std::exception was thrown!");
|
||||||
}
|
}
|
||||||
|
ERROR("hello there!");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user