Fix logging output when handing downloaded files (#1267)

* Fix logging output when processing downloaded files to remove potential ambiguity as to what events are actually occurring with individual file events post download
This commit is contained in:
abraunegg 2021-02-11 04:07:45 +11:00 committed by GitHub
parent 1bfd995153
commit f37fdda836
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 4 deletions

View file

@ -453,7 +453,8 @@ int main(string[] args)
// vdebug syncDir as set and calculated
log.vdebug("syncDir: ", syncDir);
// As we use the cfg value of sync_dir elsewhere, and if it includes a ~ it is now correctly expanded, update the configuration with new expanded value
cfg.setValueString("sync_dir", syncDir);
// Configure the logging directory if different from application default
// log_dir environment handling to handle ~ expansion properly

View file

@ -2973,7 +2973,11 @@ final class SyncEngine
}
// scan for changes in the path provided
log.vlog("Uploading differences of ", logPath);
if (isDir(logPath)) {
// if this path is a directory, output this message.
// if a file, potentially leads to confusion as to what the client is actually doing
log.vlog("Uploading differences of ", logPath);
}
Item item;
// For each unique OneDrive driveID we know about
foreach (driveId; driveIDsArray) {
@ -2983,11 +2987,13 @@ final class SyncEngine
// There could be multiple shared folders all from this same driveId
foreach(dbItem; itemdb.selectByDriveId(driveId)) {
// Does it still exist on disk in the location the DB thinks it is
log.vdebug("Calling uploadDifferences(dbItem) as item is present in local cache DB");
uploadDifferences(dbItem);
}
} else {
if (itemdb.selectByPath(path, driveId, item)) {
// Does it still exist on disk in the location the DB thinks it is
log.vdebug("Calling uploadDifferences(item) as item is present in local cache DB");
uploadDifferences(item);
}
}
@ -3088,7 +3094,13 @@ final class SyncEngine
logPath = path;
}
log.vlog("Uploading new items of ", logPath);
// scan for changes in the path provided
if (isDir(logPath)) {
// if this path is a directory, output this message.
// if a file, potentially leads to confusion as to what the client is actually doing
log.vlog("Uploading new items of ", logPath);
}
// Filesystem walk to find new files not uploaded
uploadNewItems(path);
}
@ -3311,6 +3323,9 @@ final class SyncEngine
{
// Reset upload failure - OneDrive or filesystem issue (reading data)
uploadFailed = false;
// uploadFileDifferences is called when processing DB entries to compare against actual files on disk
string itemSource = "database";
assert(item.type == ItemType.file);
if (exists(path)) {
@ -3325,12 +3340,14 @@ final class SyncEngine
localModifiedTime.fracSecs = Duration.zero;
if (localModifiedTime != itemModifiedTime) {
log.vlog("The file last modified time has changed");
log.vlog("The file last modified time has changed");
log.vdebug("The local item has a different modified time ", localModifiedTime, " when compared to ", itemSource, " modified time ", itemModifiedTime);
string eTag = item.eTag;
// perform file hash tests - has the content of the file changed?
if (!testFileHash(path, item)) {
log.vlog("The file content has changed");
log.vdebug("The local item has a different hash when compared to ", itemSource, " item hash");
write("Uploading modified file ", path, " ... ");
JSONValue response;