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;
#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<void*>(req.ssl_ctx)
, static_cast<void*>(req.ssl_ctx)
#else
, static_cast<void*>(nullptr)
, static_cast<void*>(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;
}