Rework PR #373 to reduce needless logging in monitor mode (#376)

* Rework PR #373 to reduce needless logging in monitor mode
This commit is contained in:
abraunegg 2019-02-15 07:03:15 +11:00 committed by GitHub
parent 442e3dee16
commit 51615bff0b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -480,7 +480,7 @@ int main(string[] args)
}
// Perform the sync
performSync(sync, singleDirectory, downloadOnly, localFirst, uploadOnly);
performSync(sync, singleDirectory, downloadOnly, localFirst, uploadOnly, monitor);
}
}
@ -549,7 +549,7 @@ int main(string[] args)
return EXIT_FAILURE;
}
try {
performSync(sync, singleDirectory, downloadOnly, localFirst, uploadOnly);
performSync(sync, singleDirectory, downloadOnly, localFirst, uploadOnly, monitor);
if (!downloadOnly) {
// discard all events that may have been generated by the sync
m.update(false);
@ -597,7 +597,7 @@ bool initSyncEngine(SyncEngine sync)
}
// try to synchronize the folder three times
void performSync(SyncEngine sync, string singleDirectory, bool downloadOnly, bool localFirst, bool uploadOnly)
void performSync(SyncEngine sync, string singleDirectory, bool downloadOnly, bool localFirst, bool uploadOnly, bool monitor)
{
int count;
string remotePath = "/";
@ -617,18 +617,18 @@ void performSync(SyncEngine sync, string singleDirectory, bool downloadOnly, boo
log.vlog("Syncing changes from this selected path: ", singleDirectory);
if (uploadOnly){
// Upload Only of selected single directory
log.log("Syncing changes from selected local path only - NOT syncing data changes from OneDrive ...");
if (!monitor) log.log("Syncing changes from selected local path only - NOT syncing data changes from OneDrive ...");
sync.scanForDifferences(localPath);
} else {
// No upload only
if (localFirst) {
// Local First
log.log("Syncing changes from selected local path first before downloading changes from OneDrive ...");
if (!monitor) log.log("Syncing changes from selected local path first before downloading changes from OneDrive ...");
sync.scanForDifferences(localPath);
sync.applyDifferencesSingleDirectory(remotePath);
} else {
// OneDrive First
log.log("Syncing changes from selected OneDrive path ...");
if (!monitor) log.log("Syncing changes from selected OneDrive path ...");
sync.applyDifferencesSingleDirectory(remotePath);
// is this a download only request?
if (!downloadOnly) {
@ -643,13 +643,13 @@ void performSync(SyncEngine sync, string singleDirectory, bool downloadOnly, boo
// no single directory sync
if (uploadOnly){
// Upload Only of entire sync_dir
log.log("Syncing changes from local path only - NOT syncing data changes from OneDrive ...");
if (!monitor) log.log("Syncing changes from local path only - NOT syncing data changes from OneDrive ...");
sync.scanForDifferences(localPath);
} else {
// No upload only
if (localFirst) {
// sync local files first before downloading from OneDrive
log.log("Syncing changes from local path first before downloading changes from OneDrive ...");
if (!monitor) log.log("Syncing changes from local path first before downloading changes from OneDrive ...");
sync.scanForDifferences(localPath);
sync.applyDifferences();
} else {