Skip to content

Commit

Permalink
Improve propagator log
Browse files Browse the repository at this point in the history
  • Loading branch information
TheOneRing committed Aug 30, 2023
1 parent 94b8383 commit c4f95f7
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/libsync/owncloudpropagator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ bool PropagateItemJob::scheduleSelfOrChild()
if (_state != NotYetStarted) {
return false;
}
qCInfo(lcPropagator) << "Starting" << _item->_instruction << "propagation of" << _item->destination() << "by" << this;
qCInfo(lcPropagator) << "Starting propagation of" << _item << "by" << this;

_state = Running;
if (thread() != QApplication::instance()->thread()) {
Expand Down Expand Up @@ -321,7 +321,8 @@ void PropagateItemJob::done(SyncFileItem::Status statusArg, const QString &error

PropagateItemJob *OwncloudPropagator::createJob(const SyncFileItemPtr &item)
{
bool deleteExisting = item->_instruction == CSYNC_INSTRUCTION_TYPE_CHANGE;
qCDebug(lcPropagator) << "Propagating:" << item;
const bool deleteExisting = item->_instruction == CSYNC_INSTRUCTION_TYPE_CHANGE;
switch (item->_instruction) {
case CSYNC_INSTRUCTION_REMOVE:
if (item->_direction == SyncFileItem::Down)
Expand Down Expand Up @@ -571,7 +572,6 @@ Result<QString, bool> OwncloudPropagator::localFileNameClash(const QString &relF
OC_ASSERT(!relFile.isEmpty());
if (!relFile.isEmpty() && Utility::fsCasePreserving()) {
const QFileInfo fileInfo(_localDir + relFile);
qCDebug(lcPropagator) << "CaseClashCheck for " << fileInfo.filePath();
#ifdef Q_OS_MAC
if (!fileInfo.exists()) {
return false;
Expand Down
2 changes: 1 addition & 1 deletion src/libsync/propagatedownload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,6 @@ void PropagateDownloadFile::start()
if (propagator()->_abortRequested)
return;

qCDebug(lcPropagateDownload) << _item->_file << propagator()->_activeJobList.count();
_stopwatch.start();

auto &syncOptions = propagator()->syncOptions();
Expand Down Expand Up @@ -850,6 +849,7 @@ void PropagateDownloadFile::deleteExistingFolder()
// Delete the directory if it is empty!
QDir dir(existingDir);
if (dir.entryList(QDir::NoDotAndDotDot | QDir::AllEntries).count() == 0) {
qCDebug(lcPropagateDownload) << "deleting existing dir" << existingDir << "to replace it with a file";
if (dir.rmdir(existingDir)) {
return;
}
Expand Down
1 change: 1 addition & 0 deletions src/libsync/propagatorjobs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ void PropagateLocalMkdir::start()
QFileInfo fi(newDirStr);
if (fi.exists() && fi.isFile()) {
if (_deleteExistingFile) {
qDebug(lcPropagateLocalMkdir) << "deleting existing file" << newDirStr << "to replace it with a dir";
QString removeError;
if (!FileSystem::remove(newDirStr, &removeError)) {
done(SyncFileItem::NormalError,
Expand Down
7 changes: 5 additions & 2 deletions src/libsync/syncfileitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ SyncFileItemPtr SyncFileItem::fromSyncJournalFileRecord(const SyncJournalFileRec
template <>
QString Utility::enumToDisplayName(SyncFileItem::Status s)
{
// TODO: 2.11 enumDisplayName https://github.com/owncloud/client/issues/9043
switch (s) {
case SyncFileItem::NoStatus:
return QCoreApplication::translate("SyncFileItem::Status", "Undefined");
Expand Down Expand Up @@ -120,7 +119,11 @@ QDebug operator<<(QDebug debug, const OCC::SyncFileItem *item)
} else {
QDebugStateSaver saver(debug);
debug.setAutoInsertSpaces(false);
debug << "OCC::SyncFileItem(destination=" << item->destination() << ", type=" << item->_type << ", status=" << item->_status << ")";
debug << "OCC::SyncFileItem(file=" << item->_file;
if (!item->_renameTarget.isEmpty()) {
debug << ", destination=" << item->destination();
}
debug << ", type=" << item->_type << ", instruction=" << item->_instruction << ", status=" << item->_status << ")";
}
return debug;
}

0 comments on commit c4f95f7

Please sign in to comment.