mirror of
https://github.com/abraunegg/onedrive
synced 2024-06-08 08:52:15 +02:00
Update when sync start and complete is written to application log file if enabled (#1947)
* When using the application with 'defaults' with logging enabled and no verbose mode, the application output that a sync process has started & finished is only written to the logfile every 5 sync times (25 mins). This change updates this so that, if defaults are being used with logging enabled and no verbose mode, the application will always, at a minimum, write out to the application log file when a sync was started and when it was completed. This provides important reference in the log as to when an activity began and was completed.
This commit is contained in:
parent
8a4931ccda
commit
d4b733ae89
18
src/main.d
18
src/main.d
|
@ -1303,8 +1303,16 @@ int main(string[] args)
|
|||
return EXIT_FAILURE;
|
||||
}
|
||||
try {
|
||||
string startMessage = "Starting a sync with OneDrive";
|
||||
string finishMessage = "Sync with OneDrive is complete";
|
||||
// perform a --monitor sync
|
||||
if ((cfg.getValueLong("verbose") > 0) || (logMonitorCounter == logInterval)) log.log("Starting a sync with OneDrive");
|
||||
if ((cfg.getValueLong("verbose") > 0) || (logMonitorCounter == logInterval)) {
|
||||
// log to console and log file if enabled
|
||||
log.log(startMessage);
|
||||
} else {
|
||||
// log file only if enabled so we know when a sync started when not using --verbose
|
||||
log.fileOnly(startMessage);
|
||||
}
|
||||
performSync(sync, cfg.getValueString("single_directory"), cfg.getValueBool("download_only"), cfg.getValueBool("local_first"), cfg.getValueBool("upload_only"), (logMonitorCounter == logInterval ? MONITOR_LOG_QUIET : MONITOR_LOG_SILENT), fullScanRequired, syncListConfiguredFullScanOverride, displaySyncOptions, cfg.getValueBool("monitor"), m);
|
||||
if (!cfg.getValueBool("download_only")) {
|
||||
// discard all events that may have been generated by the sync that have not already been handled
|
||||
|
@ -1315,7 +1323,13 @@ int main(string[] args)
|
|||
log.error("ERROR: The following inotify error was generated: ", e.msg);
|
||||
}
|
||||
}
|
||||
if ((cfg.getValueLong("verbose") > 0) || (logMonitorCounter == logInterval)) log.log("Sync with OneDrive is complete");
|
||||
if ((cfg.getValueLong("verbose") > 0) || (logMonitorCounter == logInterval)) {
|
||||
// log to console and log file if enabled
|
||||
log.log(finishMessage);
|
||||
} else {
|
||||
// log file only if enabled so we know when a sync completed when not using --verbose
|
||||
log.fileOnly(finishMessage);
|
||||
}
|
||||
} catch (CurlException e) {
|
||||
// we already tried three times in the performSync routine
|
||||
// if we still have problems, then the sync handle might have
|
||||
|
|
Loading…
Reference in a new issue