diff --git a/src/torrent.cpp b/src/torrent.cpp index 1aad2b437..b50df9d9c 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -2898,21 +2898,24 @@ bool is_downloading_state(int const st) req.outgoing_socket = aep.socket; #ifndef TORRENT_DISABLE_LOGGING - debug_log("==> TRACKER REQUEST \"%s\" event: %s abort: %d ssl: %p " - "port: %d ssl-port: %d fails: %d upd: %d" - , req.url.c_str() - , (req.event == tracker_request::stopped ? "stopped" - : req.event == tracker_request::started ? "started" : "") - , m_abort + if (should_log()) + { + debug_log("==> TRACKER REQUEST \"%s\" event: %s abort: %d ssl: %p " + "port: %d ssl-port: %d fails: %d upd: %d" + , req.url.c_str() + , (req.event == tracker_request::stopped ? "stopped" + : req.event == tracker_request::started ? "started" : "") + , m_abort #ifdef TORRENT_USE_OPENSSL - , static_cast(req.ssl_ctx) + , static_cast(req.ssl_ctx) #else - , static_cast(nullptr) + , static_cast(nullptr) #endif - , m_ses.listen_port() - , m_ses.ssl_listen_port() - , aep.fails - , aep.updating); + , m_ses.listen_port() + , m_ses.ssl_listen_port() + , aep.fails + , aep.updating); + } // if we're not logging session logs, don't bother creating an // observer object just for logging @@ -6431,9 +6434,12 @@ bool is_downloading_state(int const st) if (sm == nullptr && !settings().get_bool(settings_pack::enable_outgoing_tcp)) { #ifndef TORRENT_DISABLE_LOGGING - debug_log("discarding peer \"%s\": TCP connections disabled " - "[ supports-utp: %d ]", peerinfo->to_string().c_str() - , peerinfo->supports_utp); + if (should_log()) + { + debug_log("discarding peer \"%s\": TCP connections disabled " + "[ supports-utp: %d ]", peerinfo->to_string().c_str() + , peerinfo->supports_utp); + } #endif return false; }