commit - 1219b52a61799062d495375c71a8ff133dddb04f
commit + 9600075e083ffbff5ca058e9d964fb3657886903
blob - 6f1452cf12db021a5275739ddaf9a1949d6c9935
blob + 1613888c91fe30377592b8946311aade8145c9ce
--- vostok/vostok.cc
+++ vostok/vostok.cc
{
+void put_time_prefix()
+{
+ const std::time_t t{std::time(nullptr)};
+ struct tm converted{};
+ gmtime_r(&t, &converted);
+ error::g_log
+ << std::dec << std::setw(2) << std::setfill('0') << converted.tm_hour
+ << ":"
+ << std::dec << std::setw(2) << std::setfill('0') << converted.tm_min
+ << ":"
+ << std::dec << std::setw(2) << std::setfill('0') << converted.tm_sec
+ << " ";
+}
+
+
struct LogThreadId
{
LogThreadId()
{
+ put_time_prefix();
error::g_log << "+" << std::hex << m_thread_id << " ";
}
~LogThreadId()
{
+ put_time_prefix();
error::g_log << "-" << std::hex << m_thread_id << std::endl;
}
}
-void put_time_prefix()
-{
- const std::time_t t{std::time(nullptr)};
- struct tm converted{};
- gmtime_r(&t, &converted);
- error::g_log
- << std::dec << std::setw(2) << std::setfill('0') << converted.tm_hour
- << ":"
- << std::dec << std::setw(2) << std::setfill('0') << converted.tm_min
- << ":"
- << std::dec << std::setw(2) << std::setfill('0') << converted.tm_sec
- << " ";
-}
-
-
void client_thread(const transport::AcceptedClient *accepted_client, int directory_fd, const Mime &mime)
{
LogThreadId _log_thread_id;
std::unique_ptr<const transport::AcceptedClient> accepted_client{
new transport::AcceptedClient(server_socket, server_ctx)
};
- put_time_prefix();
if (accepted_client->is_accepted())
{
try