add service name

This commit is contained in:
chatlanin 2024-07-10 13:04:54 +03:00
parent 924f6521eb
commit c040322d96

View File

@ -26,7 +26,7 @@ namespace trs
~http() = default; ~http() = default;
public: public:
void init(std::string app_connection, std::string log_connection) void init(std::string service_name, std::string app_connection, std::string log_connection)
{ {
set_read_timeout(5, 0); set_read_timeout(5, 0);
set_write_timeout(5, 0); set_write_timeout(5, 0);
@ -35,6 +35,7 @@ namespace trs
set_CORS(); set_CORS();
set_post(); set_post();
database::instance().set_connection(app_connection, log_connection); database::instance().set_connection(app_connection, log_connection);
m_service_name = service_name;
} }
template<typename Function> template<typename Function>
@ -62,6 +63,7 @@ namespace trs
} }
private: private:
std::string m_service_name;
function_manager<transaction> m_function_manager; function_manager<transaction> m_function_manager;
inspector<transaction> m_inspector; inspector<transaction> m_inspector;
@ -97,6 +99,7 @@ namespace trs
catch(hack::exception& ex) catch(hack::exception& ex)
{ {
ex.transaction(tr); ex.transaction(tr);
ex.service(m_service_name);
ex.log(); ex.log();
ex.commit<database>(); ex.commit<database>();
} }