@@ -194,7 +194,11 @@ const databento::Record* LiveBlocking::NextRecord(
194194void LiveBlocking::Stop () { client_.Close (); }
195195
196196void LiveBlocking::Reconnect () {
197- log_receiver_->Receive (LogLevel::Info, " Reconnecting" );
197+ if (log_receiver_->ShouldLog (LogLevel::Info)) {
198+ std::ostringstream log_msg;
199+ log_msg << " Reconnecting to " << gateway_ << ' :' << port_;
200+ log_receiver_->Receive (LogLevel::Info, log_msg.str ());
201+ }
198202 client_ = detail::TcpClient{gateway_, port_};
199203 sub_counter_ = 0 ;
200204 session_id_ = this ->Authenticate ();
@@ -227,7 +231,7 @@ std::string LiveBlocking::DecodeChallenge() {
227231 // first line is version
228232 std::string response{reinterpret_cast <const char *>(buffer_.ReadBegin ()),
229233 buffer_.ReadCapacity ()};
230- {
234+ if (log_receiver_-> ShouldLog (LogLevel::Debug)) {
231235 std::ostringstream log_ss;
232236 log_ss << " [LiveBlocking::DecodeChallenge] Challenge: " << response;
233237 log_receiver_->Receive (LogLevel::Debug, log_ss.str ());
@@ -283,12 +287,13 @@ std::uint64_t LiveBlocking::Authenticate() {
283287 client_.WriteAll (req);
284288 const std::uint64_t session_id = DecodeAuthResp ();
285289
286- std::ostringstream log_ss;
287- log_ss << " [LiveBlocking::Authenticate] Successfully authenticated with "
288- " session_id "
289- << session_id;
290- log_receiver_->Receive (LogLevel::Info, log_ss.str ());
291-
290+ if (log_receiver_->ShouldLog (LogLevel::Info)) {
291+ std::ostringstream log_ss;
292+ log_ss << " [LiveBlocking::Authenticate] Successfully authenticated with "
293+ " session_id "
294+ << session_id;
295+ log_receiver_->Receive (LogLevel::Info, log_ss.str ());
296+ }
292297 return session_id;
293298}
294299
0 commit comments