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,6 +2898,8 @@ 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
if (should_log())
{
debug_log("==> TRACKER REQUEST \"%s\" event: %s abort: %d ssl: %p " debug_log("==> TRACKER REQUEST \"%s\" event: %s abort: %d ssl: %p "
"port: %d ssl-port: %d fails: %d upd: %d" "port: %d ssl-port: %d fails: %d upd: %d"
, req.url.c_str() , req.url.c_str()
@ -2913,6 +2915,7 @@ bool is_downloading_state(int const st)
, 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
if (should_log())
{
debug_log("discarding peer \"%s\": TCP connections disabled " debug_log("discarding peer \"%s\": TCP connections disabled "
"[ supports-utp: %d ]", peerinfo->to_string().c_str() "[ supports-utp: %d ]", peerinfo->to_string().c_str()
, peerinfo->supports_utp); , peerinfo->supports_utp);
}
#endif #endif
return false; return false;
} }