Enable event logging for debugging purposes
This commit is contained in:
parent
6828e96b53
commit
d74738a8a4
|
@ -102,6 +102,16 @@ if(SYNCTHING_CONNECTION_MOCKED)
|
|||
message(WARNING "SyncthingConnection class will be mocked")
|
||||
endif()
|
||||
|
||||
# configure whether events should be logged
|
||||
option(SYNCTHING_CONNECTION_LOG_SYNCTHING_EVENTS "enables logging event data" OFF)
|
||||
if(SYNCTHING_CONNECTION_LOG_SYNCTHING_EVENTS)
|
||||
set_source_files_properties(
|
||||
syncthingconnection.cpp
|
||||
PROPERTIES COMPILE_DEFINITIONS LIB_SYNCTHING_CONNECTOR_LOG_SYNCTHING_EVENTS
|
||||
)
|
||||
message(WARNING "SyncthingConnection class will be mocked")
|
||||
endif()
|
||||
|
||||
# include modules to apply configuration
|
||||
include(BasicConfig)
|
||||
include(QtConfig)
|
||||
|
|
|
@ -10,6 +10,10 @@
|
|||
#include <c++utilities/conversion/conversionexception.h>
|
||||
#include <c++utilities/conversion/stringconversion.h>
|
||||
|
||||
#ifdef LIB_SYNCTHING_CONNECTOR_LOG_SYNCTHING_EVENTS
|
||||
#include <c++utilities/io/ansiescapecodes.h>
|
||||
#endif
|
||||
|
||||
#include <QAuthenticator>
|
||||
#include <QHostAddress>
|
||||
#include <QJsonArray>
|
||||
|
@ -28,6 +32,9 @@
|
|||
using namespace std;
|
||||
using namespace ChronoUtilities;
|
||||
using namespace ConversionUtilities;
|
||||
#ifdef LIB_SYNCTHING_CONNECTOR_LOG_SYNCTHING_EVENTS
|
||||
using namespace EscapeCodes;
|
||||
#endif
|
||||
|
||||
namespace Data {
|
||||
|
||||
|
@ -1492,6 +1499,13 @@ void SyncthingConnection::readEvents()
|
|||
requestConfig(); // just consider current config as invalidated
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef LIB_SYNCTHING_CONNECTOR_LOG_SYNCTHING_EVENTS
|
||||
if (!replyArray.isEmpty()) {
|
||||
cout << Phrases::Info << "Received " << replyArray.size() << " Syncthing events:" << Phrases::End
|
||||
<< replyDoc.toJson(QJsonDocument::Indented).data() << endl;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case QNetworkReply::TimeoutError:
|
||||
|
|
Loading…
Reference in New Issue