Log directory/device list renewal when event logging enabled
This is useful for debugging to track (unnecessary) renewal of those lists.
This commit is contained in:
parent
205189c34a
commit
7e46096feb
|
@ -99,7 +99,7 @@ endif ()
|
|||
# configure whether events should be logged
|
||||
option(SYNCTHING_CONNECTION_LOG_SYNCTHING_EVENTS "enables logging event data to stdout (enable only for debugging!)" OFF)
|
||||
if (SYNCTHING_CONNECTION_LOG_SYNCTHING_EVENTS)
|
||||
set_property(SOURCE syncthingconnection_requests.cpp
|
||||
set_property(SOURCE syncthingconnection.cpp syncthingconnection_requests.cpp
|
||||
APPEND
|
||||
PROPERTY COMPILE_DEFINITIONS ${META_PROJECT_VARNAME_UPPER}_LOG_SYNCTHING_EVENTS)
|
||||
message(WARNING "SyncthingConnection class will log event data to stdout")
|
||||
|
|
|
@ -9,6 +9,11 @@
|
|||
|
||||
#include <c++utilities/conversion/stringconversion.h>
|
||||
|
||||
#if defined(LIB_SYNCTHING_CONNECTOR_LOG_SYNCTHING_EVENTS) || defined(LIB_SYNCTHING_CONNECTOR_LOG_API_CALLS)
|
||||
#include <c++utilities/io/ansiescapecodes.h>
|
||||
#include <iostream>
|
||||
#endif
|
||||
|
||||
#include <QAuthenticator>
|
||||
#include <QHostAddress>
|
||||
#include <QJsonArray>
|
||||
|
@ -24,6 +29,9 @@
|
|||
|
||||
using namespace std;
|
||||
using namespace CppUtilities;
|
||||
#if defined(LIB_SYNCTHING_CONNECTOR_LOG_SYNCTHING_EVENTS) || defined(LIB_SYNCTHING_CONNECTOR_LOG_API_CALLS)
|
||||
using namespace CppUtilities::EscapeCodes;
|
||||
#endif
|
||||
|
||||
namespace Data {
|
||||
|
||||
|
@ -112,6 +120,17 @@ SyncthingConnection::SyncthingConnection(const QString &syncthingUrl, const QByt
|
|||
#ifdef LIB_SYNCTHING_CONNECTOR_CONNECTION_MOCKED
|
||||
setupTestData();
|
||||
#endif
|
||||
|
||||
#ifdef LIB_SYNCTHING_CONNECTOR_LOG_SYNCTHING_EVENTS
|
||||
QObject::connect(this, &SyncthingConnection::newDirs, [] (const auto &dirs) {
|
||||
std::cerr << Phrases::Info << "Directory list renewed:" << Phrases::End;
|
||||
std::cerr << displayNames(dirs).join(QStringLiteral(", ")).toStdString() << endl;
|
||||
});
|
||||
QObject::connect(this, &SyncthingConnection::newDevices, [] (const auto &devs) {
|
||||
std::cerr << Phrases::Info << "Device list renewed:" << Phrases::End;
|
||||
std::cerr << displayNames(devs).join(QStringLiteral(", ")).toStdString() << endl;
|
||||
});
|
||||
#endif
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
Loading…
Reference in New Issue