From 1e7bc8a80f83990a07926b5c6348a4bf0faa28b6 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Thu, 17 Oct 2019 01:44:10 +0200 Subject: [PATCH] [AFV] Ref T739, reduce verbose log message --- .../afv/connection/apiserverconnection.cpp | 14 +++++++++++++- src/blackcore/afv/connection/clientconnection.cpp | 6 ++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/blackcore/afv/connection/apiserverconnection.cpp b/src/blackcore/afv/connection/apiserverconnection.cpp index 74184340f..309dc90e2 100644 --- a/src/blackcore/afv/connection/apiserverconnection.cpp +++ b/src/blackcore/afv/connection/apiserverconnection.cpp @@ -12,6 +12,7 @@ #include "blackmisc/network/external/qjsonwebtoken.h" #include "blackmisc/logmessage.h" #include "blackmisc/stringutils.h" +#include "blackconfig/buildconfig.h" #include #include @@ -23,6 +24,7 @@ using namespace BlackMisc; using namespace BlackMisc::Network; +using namespace BlackConfig; namespace BlackCore { @@ -297,7 +299,15 @@ namespace BlackCore { if (QDateTime::currentDateTimeUtc() > m_expiryLocalUtc.addSecs(-5 * 60)) { - this->connectTo(m_username, m_password, m_client, m_networkVersion, { this, [ = ](bool) {}}); + QPointer myself(this); + this->connectTo(m_username, m_password, m_client, m_networkVersion, + { + this, [ = ](bool authenticated) + { + if (!myself) { return; } + CLogMessage(this).info(u"API server authenticated '%1': %2") << m_username << boolToYesNo(authenticated); + } + }); } } @@ -316,7 +326,9 @@ namespace BlackCore void CApiServerConnection::logRequestDuration(const QNetworkReply *reply, const QString &addMsg) { + if (!CBuildConfig::isLocalDeveloperDebugBuild()) { return; } if (!reply) { return; } + const qint64 d = CNetworkUtils::requestDuration(reply); if (d < 0) { return; } if (addMsg.isEmpty()) diff --git a/src/blackcore/afv/connection/clientconnection.cpp b/src/blackcore/afv/connection/clientconnection.cpp index f3a5e277d..cfc9fb9d3 100644 --- a/src/blackcore/afv/connection/clientconnection.cpp +++ b/src/blackcore/afv/connection/clientconnection.cpp @@ -8,9 +8,11 @@ #include "clientconnection.h" #include "blackmisc/logmessage.h" +#include "blackconfig/buildconfig.h" #include +using namespace BlackConfig; using namespace BlackMisc; using namespace BlackCore::Afv::Crypto; @@ -158,7 +160,7 @@ namespace BlackCore else if (deserializer.dtoNameBuffer == HeartbeatAckDto::getShortDtoName()) { m_connection.setTsHeartbeatToNow(); - CLogMessage(this).debug(u"Received voice server heartbeat"); + if (CBuildConfig::isLocalDeveloperDebugBuild()) { CLogMessage(this).debug(u"Received voice server heartbeat"); } } else { @@ -175,7 +177,7 @@ namespace BlackCore void CClientConnection::voiceServerHeartbeat() { const QUrl voiceServerUrl("udp://" + m_connection.getTokens().VoiceServer.addressIpV4); - CLogMessage(this).debug(u"Sending voice server heartbeat to '%1'") << voiceServerUrl.host(); + if (CBuildConfig::isLocalDeveloperDebugBuild()) { CLogMessage(this).debug(u"Sending voice server heartbeat to '%1'") << voiceServerUrl.host(); } HeartbeatDto keepAlive; keepAlive.callsign = m_connection.getCallsign().toStdString(); const QByteArray dataBytes = CryptoDtoSerializer::serialize(*m_connection.m_voiceCryptoChannel, CryptoDtoMode::AEAD_ChaCha20Poly1305, keepAlive);