Skip to content

Commit

Permalink
only use debug log level for discovery traces to decrease cost
Browse files Browse the repository at this point in the history
Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
  • Loading branch information
mgallien committed Feb 6, 2025
1 parent 6678974 commit 0e91ece
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/libsync/syncengine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1216,9 +1216,9 @@ void SyncEngine::setLocalDiscoveryOptions(LocalDiscoveryStyle style, std::set<QS
_localDiscoveryStyle = style;
_localDiscoveryPaths = std::move(paths);

if (lcEngine().isInfoEnabled() && !_localDiscoveryPaths.empty()) {
if (lcEngine().isDebugEnabled() && !_localDiscoveryPaths.empty()) {
// only execute if logging is enabled
auto debug = qInfo(lcEngine);
auto debug = qDebug(lcEngine);
debug << "paths to discover locally";
for (auto path : _localDiscoveryPaths) {
debug << path;
Expand Down Expand Up @@ -1275,12 +1275,12 @@ bool SyncEngine::shouldDiscoverLocally(const QString &path) const
if (it != _localDiscoveryPaths.begin() && path.startsWith(*(--it))) {
result = it->endsWith('/') || (path.size() > it->size() && path.at(it->size()) <= '/');
if (!result) {
qCInfo(lcEngine()) << path << "no local discovery needed";
qCDebug(lcEngine()) << path << "no local discovery needed";
}
return result;
}
result = false;
qCInfo(lcEngine()) << path << "no local discovery needed";
qCDebug(lcEngine()) << path << "no local discovery needed";
return result;
}

Expand All @@ -1300,12 +1300,12 @@ bool SyncEngine::shouldDiscoverLocally(const QString &path) const
++it;
if (it == _localDiscoveryPaths.end() || !it->startsWith(path)) {
result = false;
qCInfo(lcEngine()) << path << "no local discovery needed";
qCDebug(lcEngine()) << path << "no local discovery needed";
return result;
}
}

qCInfo(lcEngine()) << path << "no local discovery needed";
qCDebug(lcEngine()) << path << "no local discovery needed";
return result;
}

Expand Down

0 comments on commit 0e91ece

Please sign in to comment.