#include #include #include namespace nb { #ifndef _NB_NO_LOGGER nb::DefaultDebugLogger logger(std::cout); #endif // _NB_NO_LOGGER bool nb::DefaultDebugLogger::process(const LogEvent& msg) { constexpr size_t level_field_width = 5; constexpr size_t msg_prompt_length = level_field_width+7; for (const auto os : this->_ostream) { *os << "["; os->width(level_field_width); *os << std::to_string(msg.lvl) << "] :: "; std::string fileloc=""; if (!msg.file.empty()) { fileloc += "(" + msg.file + ":" + std::to_string(msg.line) + ") - "; } *os << indent_strblock( fileloc + msg.msg, std::string(20 - msg_prompt_length, ' '), "" ) << nb::NEWLINE; } return true; } static bool RUN_LOGGER(nb::DefaultDebugLogger& log) { return log.run(); } const bool LOGGER_RUNNING = RUN_LOGGER(logger); } // namespace nb