more use of should_log in torrent.cpp

This commit is contained in:
Alden Torres 2018-11-18 11:50:33 -05:00 committed by Arvid Norberg
parent f3d1352cb3
commit 295bcc08e5
1 changed files with 21 additions and 15 deletions

View File

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