Skip to content

Commit

Permalink
Fix suppression
Browse files Browse the repository at this point in the history
* Fix suppression
  • Loading branch information
abraunegg committed May 6, 2024
1 parent 9aaf633 commit 66cd932
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 30 deletions.
2 changes: 1 addition & 1 deletion src/config.d
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class ApplicationConfig {

// Sync Operations
bool fullScanTrueUpRequired = false;
bool surpressLoggingOutput = false;
bool suppressLoggingOutput = false;

// Number of concurrent threads when downloading and uploading data
ulong defaultConcurrentThreads = 8;
Expand Down
14 changes: 6 additions & 8 deletions src/main.d
Original file line number Diff line number Diff line change
Expand Up @@ -931,27 +931,25 @@ int main(string[] cliArgs) {
// unsurpress the logging output
monitorLogOutputLoopCount = 1;
addLogEntry("Unsuppressing initial sync log output", ["debug"]);
appConfig.surpressLoggingOutput = false;
appConfig.suppressLoggingOutput = false;
} else {
// do we suppress the logging output to absolute minimal
if (monitorLoopFullCount == 1) {
// application startup with --monitor
addLogEntry("Unsuppressing initial sync log output", ["debug"]);
appConfig.surpressLoggingOutput = false;
appConfig.suppressLoggingOutput = false;
} else {
// only suppress if we are not doing --verbose or higher
if (appConfig.verbosityCount == 0) {
addLogEntry("Suppressing --monitor log output", ["debug"]);
appConfig.surpressLoggingOutput = true;
appConfig.suppressLoggingOutput = true;
} else {
addLogEntry("Unsuppressing log output", ["debug"]);
appConfig.surpressLoggingOutput = false;
appConfig.suppressLoggingOutput = false;
}
}
}

appConfig.surpressLoggingOutput = false; // TO REMOVE

// How long has the application been running for?
auto elapsedTime = Clock.currTime() - applicationStartTime;
addLogEntry("Application run-time thus far: " ~ to!string(elapsedTime), ["debug"]);
Expand Down Expand Up @@ -1147,7 +1145,7 @@ void performUploadOnlySyncProcess(string localPath, Monitor filesystemMonitor =
void performStandardSyncProcess(string localPath, Monitor filesystemMonitor = null) {

// If we are performing log suppression, output this message so the user knows what is happening
if (appConfig.surpressLoggingOutput) {
if (appConfig.suppressLoggingOutput) {
addLogEntry("Syncing changes from Microsoft OneDrive ...");
}

Expand Down Expand Up @@ -1217,7 +1215,7 @@ void performStandardSyncProcess(string localPath, Monitor filesystemMonitor = nu
// 'force_children_scan' is used when using /children rather than /delta and it is not efficient to re-run this exact same process twice
if (!appConfig.getValueBool("force_children_scan")) {
// Perform the final true up scan to ensure we have correctly replicated the current online state locally
if (!appConfig.surpressLoggingOutput) {
if (!appConfig.suppressLoggingOutput) {
addLogEntry("Performing a last examination of the most recent online data within Microsoft OneDrive to complete the reconciliation process");
}
// We pass in the 'appConfig.fullScanTrueUpRequired' value which then flags do we use the configured 'deltaLink'
Expand Down
42 changes: 21 additions & 21 deletions src/sync.d
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ class SyncEngine {
}

// Directory name is not excluded or skip_dir is not populated
if (!appConfig.surpressLoggingOutput) {
if (!appConfig.suppressLoggingOutput) {
addLogEntry("Syncing this OneDrive Personal Shared Folder: " ~ remoteItem.name);
}
// Check this OneDrive Personal Shared Folder for changes
Expand Down Expand Up @@ -682,7 +682,7 @@ class SyncEngine {
}

// Directory name is not excluded or skip_dir is not populated
if (!appConfig.surpressLoggingOutput) {
if (!appConfig.suppressLoggingOutput) {
addLogEntry("Syncing this OneDrive Business Shared Folder: " ~ remoteItem.name);
}

Expand Down Expand Up @@ -889,7 +889,7 @@ class SyncEngine {

// Dynamic output for non-verbose and verbose run so that the user knows something is being retrieved from the OneDrive API
if (appConfig.verbosityCount == 0) {
if (!appConfig.surpressLoggingOutput) {
if (!appConfig.suppressLoggingOutput) {
addProcessingLogHeaderEntry("Fetching items from the OneDrive API for Drive ID: " ~ driveIdToQuery, appConfig.verbosityCount);
}
} else {
Expand Down Expand Up @@ -921,7 +921,7 @@ class SyncEngine {

if (appConfig.verbosityCount == 0) {
// Dynamic output for a non-verbose run so that the user knows something is happening
if (!appConfig.surpressLoggingOutput) {
if (!appConfig.suppressLoggingOutput) {
addProcessingDotEntry();
}
} else {
Expand Down Expand Up @@ -1006,7 +1006,7 @@ class SyncEngine {

// Log that we have finished querying the /delta API
if (appConfig.verbosityCount == 0) {
if (!appConfig.surpressLoggingOutput) {
if (!appConfig.suppressLoggingOutput) {
// Close out the '....' being printed to the console
addLogEntry("\n", ["consoleOnlyNoNewLine"]);
}
Expand Down Expand Up @@ -1070,7 +1070,7 @@ class SyncEngine {
addLogEntry("------------------------------------------------------------------", ["debug"]);

// Log that we have finished generating our self generated /delta response
if (!appConfig.surpressLoggingOutput) {
if (!appConfig.suppressLoggingOutput) {
addLogEntry("Finished processing self generated /delta JSON response from the OneDrive API");
}
}
Expand All @@ -1094,7 +1094,7 @@ class SyncEngine {
ulong batchesProcessed = 0;

// Dynamic output for a non-verbose run so that the user knows something is happening
if (!appConfig.surpressLoggingOutput) {
if (!appConfig.suppressLoggingOutput) {
addProcessingLogHeaderEntry("Processing " ~ to!string(jsonItemsToProcess.length) ~ " applicable changes and items received from Microsoft OneDrive", appConfig.verbosityCount);
}

Expand All @@ -1106,7 +1106,7 @@ class SyncEngine {

if (appConfig.verbosityCount == 0) {
// Dynamic output for a non-verbose run so that the user knows something is happening
if (!appConfig.surpressLoggingOutput) {
if (!appConfig.suppressLoggingOutput) {
addProcessingDotEntry();
}
} else {
Expand All @@ -1122,7 +1122,7 @@ class SyncEngine {

if (appConfig.verbosityCount == 0) {
// close off '.' output
if (!appConfig.surpressLoggingOutput) {
if (!appConfig.suppressLoggingOutput) {
addLogEntry("\n", ["consoleOnlyNoNewLine"]);
}
}
Expand All @@ -1134,8 +1134,8 @@ class SyncEngine {
// Free up memory and items processed as it is pointless now having this data around
jsonItemsToProcess = [];
} else {
if (!appConfig.surpressLoggingOutput) {
addLogEntry("No additional changes or items that can be applied were discovered while processing the data received from Microsoft OneDrive");
if (!appConfig.suppressLoggingOutput) {
addLogEntry("No changes or items that can be applied were discovered while processing the data received from Microsoft OneDrive");
}
}

Expand Down Expand Up @@ -2885,7 +2885,7 @@ class SyncEngine {
void performDatabaseConsistencyAndIntegrityCheck() {

// Log what we are doing
if (!appConfig.surpressLoggingOutput) {
if (!appConfig.suppressLoggingOutput) {
addProcessingLogHeaderEntry("Performing a database consistency and integrity check on locally stored data", appConfig.verbosityCount);
}

Expand Down Expand Up @@ -2980,7 +2980,7 @@ class SyncEngine {
}

// Close out the '....' being printed to the console
if (!appConfig.surpressLoggingOutput) {
if (!appConfig.suppressLoggingOutput) {
if (appConfig.verbosityCount == 0) {
addLogEntry("\n", ["consoleOnlyNoNewLine"]);
}
Expand Down Expand Up @@ -3042,7 +3042,7 @@ class SyncEngine {
// Log what we are doing
addLogEntry("Processing: " ~ logOutputPath, ["verbose"]);
// Add a processing '.'
if (!appConfig.surpressLoggingOutput) {
if (!appConfig.suppressLoggingOutput) {
if (appConfig.verbosityCount == 0) {
addProcessingDotEntry();
}
Expand Down Expand Up @@ -4237,7 +4237,7 @@ class SyncEngine {

// Log the action that we are performing, however only if this is a directory
if (isDir(path)) {
if (!appConfig.surpressLoggingOutput) {
if (!appConfig.suppressLoggingOutput) {
if (!cleanupLocalFiles) {
addProcessingLogHeaderEntry("Scanning the local file system '" ~ logPath ~ "' for new data to upload", appConfig.verbosityCount);
} else {
Expand All @@ -4250,7 +4250,7 @@ class SyncEngine {
addLogEntry("Starting Filesystem Walk: " ~ to!string(startTime), ["debug"]);

// Add a processing '.'
if (!appConfig.surpressLoggingOutput) {
if (!appConfig.suppressLoggingOutput) {
if (appConfig.verbosityCount == 0) {
addProcessingDotEntry();
}
Expand All @@ -4260,7 +4260,7 @@ class SyncEngine {
scanPathForNewData(path);

if (appConfig.verbosityCount == 0) {
if (!appConfig.surpressLoggingOutput) {
if (!appConfig.suppressLoggingOutput) {
// Close out the '....' being printed to the console
addLogEntry("\n", ["consoleOnlyNoNewLine"]);
}
Expand Down Expand Up @@ -4341,7 +4341,7 @@ class SyncEngine {

// Add a processing '.'
if (isDir(path)) {
if (!appConfig.surpressLoggingOutput) {
if (!appConfig.suppressLoggingOutput) {
if (appConfig.verbosityCount == 0) {
addProcessingDotEntry();
}
Expand Down Expand Up @@ -6287,7 +6287,7 @@ class SyncEngine {

// Dynamic output for a non-verbose run so that the user knows something is happening
if (appConfig.verbosityCount == 0) {
if (!appConfig.surpressLoggingOutput) {
if (!appConfig.suppressLoggingOutput) {
addProcessingLogHeaderEntry("Fetching items from the OneDrive API for Drive ID: " ~ searchItem.driveId, appConfig.verbosityCount);
}
} else {
Expand Down Expand Up @@ -6397,7 +6397,7 @@ class SyncEngine {

if (appConfig.verbosityCount == 0) {
// Dynamic output for a non-verbose run so that the user knows something is happening
if (!appConfig.surpressLoggingOutput) {
if (!appConfig.suppressLoggingOutput) {
addLogEntry("\n", ["consoleOnlyNoNewLine"]);
}
}
Expand Down Expand Up @@ -6441,7 +6441,7 @@ class SyncEngine {

if (appConfig.verbosityCount == 0) {
// Dynamic output for a non-verbose run so that the user knows something is happening
if (!appConfig.surpressLoggingOutput) {
if (!appConfig.suppressLoggingOutput) {
addProcessingDotEntry();
}
}
Expand Down

0 comments on commit 66cd932

Please sign in to comment.