implement custom protobuf debug string creation (#4532)

* implement custom protobuf debug log string creation

* add version guards

* add missing header

* debian10 repository misses headers

* clean up logging messages a bit

* fix some more formatting on debug messages
This commit is contained in:
ebbit1q 2022-02-23 23:46:23 +01:00 committed by GitHub
parent eb3ce1fd7e
commit 7108eb42c8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 178 additions and 51 deletions

View file

@ -1,5 +1,6 @@
#include "remoteclient.h"
#include "debug_pb_message.h"
#include "main.h"
#include "passwordhasher.h"
#include "pb/event_server_identification.pb.h"
@ -387,7 +388,7 @@ void RemoteClient::readData()
ServerMessage newServerMessage;
newServerMessage.ParseFromArray(inputBuffer.data(), messageLength);
#ifdef QT_DEBUG
qDebug() << "IN" << messageLength << QString::fromStdString(newServerMessage.ShortDebugString());
qDebug().noquote() << "IN" << getSafeDebugString(newServerMessage);
#endif
inputBuffer.remove(0, messageLength);
messageInProgress = false;
@ -405,7 +406,7 @@ void RemoteClient::websocketMessageReceived(const QByteArray &message)
ServerMessage newServerMessage;
newServerMessage.ParseFromArray(message.data(), message.length());
#ifdef QT_DEBUG
qDebug() << "IN" << messageLength << QString::fromStdString(newServerMessage.ShortDebugString());
qDebug().noquote() << "IN" << getSafeDebugString(newServerMessage);
#endif
processProtocolItem(newServerMessage);
}
@ -418,7 +419,7 @@ void RemoteClient::sendCommandContainer(const CommandContainer &cont)
auto size = static_cast<unsigned int>(cont.ByteSize());
#endif
#ifdef QT_DEBUG
qDebug() << "OUT" << size << QString::fromStdString(cont.ShortDebugString());
qDebug().noquote() << "OUT" << getSafeDebugString(cont);
#endif
QByteArray buf;