add function name

This commit is contained in:
chatlanin 2024-07-10 13:02:15 +03:00
parent 27f222adce
commit 63c712207d
2 changed files with 6 additions and 3 deletions

View File

@ -55,8 +55,9 @@ namespace hack
void log()
{
error("", m_location)(m_message);
warn("", m_location)(m_description);
error(" : ", m_location)(m_service, m_message);
if (!m_description.empty())
warn("", m_location)(m_description);
if (!m_system_error.empty())
warn("", m_location)("system_error: ", m_system_error);
}
@ -68,9 +69,10 @@ namespace hack
j["description"] = m_description;
j["system_error"] = m_system_error;
j["location"] = m_location.file_name();
j["params"] = m_params;
j["function"] = m_location.function_name();
j["message"] = m_message;
j["service"] = m_service;
j["params"] = m_params;
return j;
}

View File

@ -5,6 +5,7 @@
auto main(int argc, char *argv[]) -> int
{
hack::exception ex;
ex.service("test service");
ex.log();
}