105{
106
107 auto tp = std::chrono::system_clock::now();
108 auto t = std::chrono::system_clock::to_time_t(tp);
109 auto local_t = time_t_to_localtime(t);
110
111 auto dur = tp.time_since_epoch();
112 auto sec = std::chrono::duration_cast<std::chrono::seconds>(dur);
113
114 auto ms =
115 std::chrono::duration_cast<std::chrono::milliseconds>(dur - sec).count();
116
117 std::ostringstream sstrm;
118
119 char time_buffer[80];
120 std::strftime(
121 time_buffer, sizeof(time_buffer), "%d/%m/%Y %H:%M:%S.", &local_t);
122 sstrm << time_buffer << std::setfill('0') << std::setw(3) << ms << ' '
123 << lvl << ": [" << std::this_thread::get_id() << "] " << instance_name
124 << '[' << cluster_name << "] [" << client::version() << "] " << msg
125 << '\n';
126
127 {
128 std::lock_guard<std::mutex> g(cout_lock_);
129 std::cout << sstrm.str() << std::flush;
130 }
131}