Commit Diff


commit - 4613bf1c4fa827736cdd51b4b653be8381c7d9d7
commit + 70d0dc979f7d264345d4edaac791b46aeb6e380d
blob - 6baca4a63621b979b8a99635af6e57c175e237a9
blob + abaf9220415ccb1456e534ce9d87711302b84516
--- vostok/transport.cc
+++ vostok/transport.cc
@@ -3,8 +3,10 @@
 #include "error.h"
 #include "transport.h"
 
+#include <array>
 #include <sys/socket.h>
 #include <netinet/in.h>
+#include <arpa/inet.h>
 
 
 namespace vostok
@@ -122,6 +124,13 @@ AcceptedClient::AcceptedClient(int server_socket, stru
         return;
     }
 
+    {
+        std::array<char, 128> addr_str{};
+        auto printable = inet_ntop(AF_INET, &addr.sin_addr, &addr_str[0], addr_str.size());
+        if (printable)
+            error::g_log << printable << " ";
+    }
+
     struct tls *ctx = nullptr;
     if (tls_accept_socket(server_ctx, &ctx, m_fd.get()) == -1)
     {
blob - b31bdb54934d0291bfc573eb0c4c321bb17e3d91
blob + 4be25cb4c2ff370d6e4ae0174dd272237a97e7fc
--- vostok/vostok.cc
+++ vostok/vostok.cc
@@ -17,6 +17,7 @@
 
 #include <time.h>
 #include <ctime>
+#include <iomanip>
 
 
 namespace vostok
@@ -62,7 +63,13 @@ void put_time_prefix()
     const std::time_t t{std::time(nullptr)};
     struct tm converted{};
     gmtime_r(&t, &converted);
-    error::g_log << converted.tm_hour << ":" << converted.tm_min << ":" << converted.tm_sec << " ";
+    error::g_log 
+        << std::setw(2) << std::setfill('0') << converted.tm_hour 
+        << ":"
+        << std::setw(2) << std::setfill('0') << converted.tm_min 
+        << ":" 
+        << std::setw(2) << std::setfill('0') << converted.tm_sec 
+        << " ";
 }
 
 
@@ -199,9 +206,9 @@ bool server_loop(int server_socket, NotNull<struct tls
         std::unique_ptr<const transport::AcceptedClient> accepted_client{
             new transport::AcceptedClient(server_socket, server_ctx)
         };
+        put_time_prefix();
         if (accepted_client->is_accepted())
         {
-            put_time_prefix();
             try
             {
                 std::thread{client_thread, accepted_client.get(), directory_fd, mime}.detach();