add new log to exception

This commit is contained in:
chatlanin 2024-07-13 21:33:20 +03:00
parent bc1c3ff1f0
commit 09881403cd

View File

@ -8,6 +8,7 @@
#define DEF_LINE() std::experimental::source_location::current().line()
#define DEF_LOCATION() std::experimental::source_location::current()
#include "hack/view/color.hpp"
#include "hack/logger/logger.hpp"
#include "hack/utils/json_converter.hpp"
@ -55,11 +56,25 @@ namespace hack
void log()
{
error(" : ", m_location)(m_service, m_message);
std::cout << view::color::bold << view::color::red <<"["+m_service+"] " << view::color::reset
<< m_location.file_name() << ":"
<< view::color::italic << view::color::yellow << m_location.function_name() << "()" << view::color::reset
<< view::color::bold << view::color::blue << "[" << m_location.line() << "]" << view::color::reset << ": "
<< m_message << std::endl;
if (!m_description.empty())
warn("", m_location)(m_description);
std::cout << view::color::bold << view::color::red <<"["+m_service+"] " << view::color::reset
<< m_location.file_name() << ":"
<< view::color::italic << view::color::yellow << m_location.function_name() << "()" << view::color::reset
<< view::color::bold << view::color::blue << "[" << m_location.line() << "]" << view::color::reset << ": "
<< m_description << std::endl;
if (!m_system_error.empty())
warn("", m_location)("system_error: ", m_system_error);
std::cout << view::color::bold << view::color::red <<"["+m_service+"] " << view::color::reset
<< m_location.file_name() << ":"
<< view::color::italic << view::color::yellow << m_location.function_name() << "()" << view::color::reset
<< view::color::bold << view::color::blue << "[" << m_location.line() << "]" << view::color::reset << ": "
<< m_system_error << std::endl;
}
private: