From 8e59023534f2f2519919e84bc0adaef13ac26bd4 Mon Sep 17 00:00:00 2001 From: Antony Male Date: Sat, 20 May 2017 18:16:55 +0100 Subject: [PATCH 01/29] Re-enable installer compression (oops...) --- installer/common.iss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/installer/common.iss b/installer/common.iss index 322a9a0c..a3606cf4 100644 --- a/installer/common.iss +++ b/installer/common.iss @@ -29,8 +29,8 @@ OutputDir="." OutputBaseFilename={#AppName}Setup-{#Arch} SetupIconFile={#AppSrc}\Icons\default.ico WizardSmallImageFile=..\icon.bmp -;Compression=lzma2/max -Compression=None +Compression=lzma2/max +;Compression=None SolidCompression=yes PrivilegesRequired=admin CloseApplications=yes From 29c7e43a6c3c250ecc983fbaa89c141b9ac89077 Mon Sep 17 00:00:00 2001 From: Antony Male Date: Thu, 25 May 2017 21:11:17 +0100 Subject: [PATCH 02/29] Tweak all of the log levels, with a view to making it Info --- src/SyncTrayzor/Services/AutostartProvider.cs | 10 +++++----- .../Services/Config/ConfigurationProvider.cs | 6 +++--- .../Services/Conflicts/ConflictFileWatcher.cs | 2 +- src/SyncTrayzor/Services/DirectoryWatcher.cs | 2 +- src/SyncTrayzor/Services/FileWatcher.cs | 6 +++--- .../Services/Ipc/IpcCommsClientFactory.cs | 4 ++-- src/SyncTrayzor/Services/MemoryUsageLogger.cs | 2 +- .../Services/Metering/MeteredNetworkManager.cs | 18 +++++++++--------- .../Services/Metering/NetworkCostManager.cs | 6 +++--- .../Services/ProcessStartProvider.cs | 8 ++++---- .../PortableUpdateVariantHandler.cs | 2 +- .../UpdateManagement/UpdateDownloader.cs | 2 +- .../Services/UpdateManagement/UpdateManager.cs | 4 ++-- .../Syncthing/ApiClient/SyncthingApiClient.cs | 6 +++--- .../ApiClient/SyncthingHttpClientHandler.cs | 10 +++++++++- .../EventWatcher/SyncthingEventWatcher.cs | 2 +- src/SyncTrayzor/Syncthing/SyncthingManager.cs | 2 +- src/SyncTrayzor/Syncthing/SyncthingPoller.cs | 2 +- .../Syncthing/SyncthingProcessRunner.cs | 4 ++-- 19 files changed, 53 insertions(+), 45 deletions(-) diff --git a/src/SyncTrayzor/Services/AutostartProvider.cs b/src/SyncTrayzor/Services/AutostartProvider.cs index 3efc5319..029ec95b 100644 --- a/src/SyncTrayzor/Services/AutostartProvider.cs +++ b/src/SyncTrayzor/Services/AutostartProvider.cs @@ -77,7 +77,7 @@ private void CheckAccess() this._canWrite = true; this._canRead = true; - logger.Info("Have read/write access to the registry"); + logger.Debug("Have read/write access to the registry"); return; } } @@ -95,7 +95,7 @@ private void CheckAccess() new RegistryPermission(RegistryPermissionAccess.Read, runPathWithHive).Demand(); this._canRead = true; - logger.Info("Have read-only access to the registry"); + logger.Warn("Have read-only access to the registry"); return; } } @@ -103,7 +103,7 @@ private void CheckAccess() catch (SecurityException) { } catch (UnauthorizedAccessException) { } - logger.Info("Have no access to the registry"); + logger.Warn("Have no access to the registry"); } private string FindKeyName() @@ -180,7 +180,7 @@ public AutostartConfiguration GetCurrentSetup() } var config = new AutostartConfiguration() { AutoStart = autoStart, StartMinimized = startMinimized }; - logger.Info("GetCurrentSetup determined that the current configuration is: {0}", config); + logger.Debug("GetCurrentSetup determined that the current configuration is: {0}", config); return config; } @@ -189,7 +189,7 @@ public void SetAutoStart(AutostartConfiguration config) if (!this.CanWrite) throw new InvalidOperationException("Don't have permission to write to the registry"); - logger.Info("Setting AutoStart to {0}", config); + logger.Debug("Setting AutoStart to {0}", config); using (var registryKey = this.OpenRegistryKey(true)) { diff --git a/src/SyncTrayzor/Services/Config/ConfigurationProvider.cs b/src/SyncTrayzor/Services/Config/ConfigurationProvider.cs index 494b6ac0..7a71ddbc 100644 --- a/src/SyncTrayzor/Services/Config/ConfigurationProvider.cs +++ b/src/SyncTrayzor/Services/Config/ConfigurationProvider.cs @@ -118,7 +118,7 @@ public void Initialize(Configuration defaultConfiguration) if (!this.filesystem.FileExists(expandedSyncthingPath)) { // We know that this.paths.SyncthingBackupPath exists, because we checked this above - logger.Info("Syncthing doesn't exist at {0}, so copying from {1}", expandedSyncthingPath, this.paths.SyncthingBackupPath); + logger.Warn("Syncthing doesn't exist at {0}, so copying from {1}", expandedSyncthingPath, this.paths.SyncthingBackupPath); var expandedSyncthingPathDir = Path.GetDirectoryName(expandedSyncthingPath); if (!this.filesystem.DirectoryExists(expandedSyncthingPathDir)) @@ -140,7 +140,7 @@ private Configuration LoadFromDisk(Configuration defaultConfiguration, out bool // Merge any updates from app.config / Configuration into the configuration file on disk // (creating if necessary) - logger.Debug("Loaded default configuration: {0}", defaultConfiguration); + logger.Info("Loaded default configuration: {0}", defaultConfiguration); XDocument defaultConfig; using (var ms = new System.IO.MemoryStream()) { @@ -167,7 +167,7 @@ private Configuration LoadFromDisk(Configuration defaultConfiguration, out bool } else { - logger.Debug($"Configuration file {this.paths.ConfigurationFilePath} doesn't exist, so creating"); + logger.Info($"Configuration file {this.paths.ConfigurationFilePath} doesn't exist, so creating"); hadToCreate = true; loadedConfig = defaultConfig; } diff --git a/src/SyncTrayzor/Services/Conflicts/ConflictFileWatcher.cs b/src/SyncTrayzor/Services/Conflicts/ConflictFileWatcher.cs index 58625739..a128ecfb 100644 --- a/src/SyncTrayzor/Services/Conflicts/ConflictFileWatcher.cs +++ b/src/SyncTrayzor/Services/Conflicts/ConflictFileWatcher.cs @@ -162,7 +162,7 @@ private void RefreshConflictedFiles() this.conflictedFiles = conflictFiles.ToList(); - logger.Info($"Refreshing conflicted files. Found {this.conflictedFiles.Count} from {this.conflictFileOptions.Count} options"); + logger.Debug($"Refreshing conflicted files. Found {this.conflictedFiles.Count} from {this.conflictFileOptions.Count} options"); } this.ConflictedFilesChanged?.Invoke(this, EventArgs.Empty); diff --git a/src/SyncTrayzor/Services/DirectoryWatcher.cs b/src/SyncTrayzor/Services/DirectoryWatcher.cs index 8d73b5df..251a431f 100644 --- a/src/SyncTrayzor/Services/DirectoryWatcher.cs +++ b/src/SyncTrayzor/Services/DirectoryWatcher.cs @@ -142,7 +142,7 @@ private bool OnPreviewDirectoryChanged(string subPath, bool pathExists) private void OnDirectoryChanged(string subPath) { - logger.Info("Path Changed: {0}", Path.Combine(this.Directory, subPath)); + logger.Debug("Path Changed: {0}", Path.Combine(this.Directory, subPath)); this.DirectoryChanged?.Invoke(this, new DirectoryChangedEventArgs(this.Directory, subPath)); } diff --git a/src/SyncTrayzor/Services/FileWatcher.cs b/src/SyncTrayzor/Services/FileWatcher.cs index fe56bbd2..16c08c79 100644 --- a/src/SyncTrayzor/Services/FileWatcher.cs +++ b/src/SyncTrayzor/Services/FileWatcher.cs @@ -131,12 +131,12 @@ private void CheckExistence() var exists = System.IO.Directory.Exists(this.Directory); if (exists && this.watcher == null) { - logger.Info("Path {0} appeared. Creating watcher", this.Directory); + logger.Debug("Path {0} appeared. Creating watcher", this.Directory); this.watcher = this.TryToCreateWatcher(this.Directory); } else if (!exists && this.watcher != null) { - logger.Info("Path {0} disappeared. Destroying watcher", this.Directory); + logger.Debug("Path {0} disappeared. Destroying watcher", this.Directory); this.watcher.Dispose(); this.watcher = null; } @@ -172,7 +172,7 @@ private void OnChanged(object source, FileSystemEventArgs e) } catch (Exception ex) { - logger.Error(ex, $"Failed to see whether file/dir {e.FullPath} exists"); + logger.Warn(ex, $"Failed to see whether file/dir {e.FullPath} exists"); } } diff --git a/src/SyncTrayzor/Services/Ipc/IpcCommsClientFactory.cs b/src/SyncTrayzor/Services/Ipc/IpcCommsClientFactory.cs index 4325222b..f0a38898 100644 --- a/src/SyncTrayzor/Services/Ipc/IpcCommsClientFactory.cs +++ b/src/SyncTrayzor/Services/Ipc/IpcCommsClientFactory.cs @@ -33,7 +33,7 @@ public IIpcCommsClient TryCreateClient() // Only care if the process came from our session: allow multiple instances under different users if (String.Equals(process.MainModule.FileName, ourLocation, StringComparison.OrdinalIgnoreCase) && process.SessionId == ourProcess.SessionId && process.Id != ourProcess.Id) { - logger.Debug("Found process with ID {0} and location {1}", process.Id, process.MainModule.FileName); + logger.Info("Found process with ID {0} and location {1}", process.Id, process.MainModule.FileName); return new IpcCommsClient(process.Id); } else if (process.Id != ourProcess.Id) @@ -43,7 +43,7 @@ public IIpcCommsClient TryCreateClient() } catch (Exception e) { - logger.Error(e, $"Error accessing information for process with PID {process.Id}"); + logger.Warn(e, $"Error accessing information for process with PID {process.Id}"); } } diff --git a/src/SyncTrayzor/Services/MemoryUsageLogger.cs b/src/SyncTrayzor/Services/MemoryUsageLogger.cs index 1a8c6006..4054b03a 100644 --- a/src/SyncTrayzor/Services/MemoryUsageLogger.cs +++ b/src/SyncTrayzor/Services/MemoryUsageLogger.cs @@ -31,7 +31,7 @@ public MemoryUsageLogger() }; this.timer.Elapsed += (o, e) => { - logger.Debug("Working Set: {0}. Private Memory Size: {1}. GC Total Memory: {2}", + logger.Info("Working Set: {0}. Private Memory Size: {1}. GC Total Memory: {2}", FormatUtils.BytesToHuman(this.process.WorkingSet64), FormatUtils.BytesToHuman(this.process.PrivateMemorySize64), FormatUtils.BytesToHuman(GC.GetTotalMemory(true))); }; diff --git a/src/SyncTrayzor/Services/Metering/MeteredNetworkManager.cs b/src/SyncTrayzor/Services/Metering/MeteredNetworkManager.cs index 05fde211..6e49d56a 100644 --- a/src/SyncTrayzor/Services/Metering/MeteredNetworkManager.cs +++ b/src/SyncTrayzor/Services/Metering/MeteredNetworkManager.cs @@ -124,12 +124,12 @@ private void DevicePaused(object sender, DevicePausedEventArgs e) if (deviceState == DeviceState.Unpaused) { this.deviceStates[e.Device] = DeviceState.PausedRenegade; - logger.Info($"Device {e.Device.DeviceId} has been paused, and has gone renegade"); + logger.Debug($"Device {e.Device.DeviceId} has been paused, and has gone renegade"); } else if (deviceState == DeviceState.UnpausedRenegade) { this.deviceStates[e.Device] = DeviceState.Paused; - logger.Info($"Device {e.Device.DeviceId} has been paused, and has stopped being renegade"); + logger.Debug($"Device {e.Device.DeviceId} has been paused, and has stopped being renegade"); changed = true; } } @@ -155,13 +155,13 @@ private void DeviceResumed(object sender, DeviceResumedEventArgs e) if (deviceState == DeviceState.Paused) { this.deviceStates[e.Device] = DeviceState.UnpausedRenegade; - logger.Info($"Device {e.Device.DeviceId} has been resumed, and has gone renegade"); + logger.Debug($"Device {e.Device.DeviceId} has been resumed, and has gone renegade"); changed = true; } else if (deviceState == DeviceState.PausedRenegade) { this.deviceStates[e.Device] = DeviceState.Unpaused; - logger.Info($"Device {e.Device.DeviceId} has been resumed, and has stopped being renegade"); + logger.Debug($"Device {e.Device.DeviceId} has been resumed, and has stopped being renegade"); } } @@ -190,7 +190,7 @@ private void NetworkCostsChanged(object sender, EventArgs e) if (!this.IsEnabled) return; - logger.Info("Network costs changed. Updating devices"); + logger.Debug("Network costs changed. Updating devices"); this.ResetRenegades(); this.Update(); } @@ -200,7 +200,7 @@ private void NetworksChanged(object sender, EventArgs e) if (!this.IsEnabled) return; - logger.Info("Networks changed. Updating devices"); + logger.Debug("Networks changed. Updating devices"); this.ResetRenegades(); this.Update(); } @@ -295,7 +295,7 @@ private async Task UpdateDeviceAsync(Device device) if (deviceState == DeviceState.PausedRenegade || deviceState == DeviceState.UnpausedRenegade) { - logger.Info($"Skipping update of device {device.DeviceId} as it has gone renegade"); + logger.Debug($"Skipping update of device {device.DeviceId} as it has gone renegade"); return false; } @@ -307,7 +307,7 @@ private async Task UpdateDeviceAsync(Device device) if (shouldBePaused && !device.Paused) { - logger.Info($"Pausing device {device.DeviceId}"); + logger.Debug($"Pausing device {device.DeviceId}"); try { await this.syncthingManager.Devices.PauseDeviceAsync(device); @@ -325,7 +325,7 @@ private async Task UpdateDeviceAsync(Device device) } else if (!shouldBePaused && device.Paused) { - logger.Info($"Resuming device {device.DeviceId}"); + logger.Debug($"Resuming device {device.DeviceId}"); try { await this.syncthingManager.Devices.ResumeDeviceAsync(device); diff --git a/src/SyncTrayzor/Services/Metering/NetworkCostManager.cs b/src/SyncTrayzor/Services/Metering/NetworkCostManager.cs index a82f57fe..363c52be 100644 --- a/src/SyncTrayzor/Services/Metering/NetworkCostManager.cs +++ b/src/SyncTrayzor/Services/Metering/NetworkCostManager.cs @@ -73,17 +73,17 @@ public bool IsConnectionMetered(IPAddress address) catch (ArgumentException e) { // See #210 - logger.Error(e, $"GetCost failed (ArgumentException). IP: {address}, Bytes: {BitConverter.ToString(sockAddr.data)}"); + logger.Warn(e, $"GetCost failed (ArgumentException). IP: {address}, Bytes: {BitConverter.ToString(sockAddr.data)}"); } catch (COMException e) { // See #215 - logger.Error(e, $"GetCost failed (COMException, HResult {e.HResult}). IP: {address}, Bytes: {BitConverter.ToString(sockAddr.data)}"); + logger.Warn(e, $"GetCost failed (COMException, HResult {e.HResult}). IP: {address}, Bytes: {BitConverter.ToString(sockAddr.data)}"); } catch (Exception e) { // Being safe... - logger.Error(e, $"GetCost failed for an unknown reason. IP: {address}, Bytes: {BitConverter.ToString(sockAddr.data)}"); + logger.Warn(e, $"GetCost failed for an unknown reason. IP: {address}, Bytes: {BitConverter.ToString(sockAddr.data)}"); } return false; diff --git a/src/SyncTrayzor/Services/ProcessStartProvider.cs b/src/SyncTrayzor/Services/ProcessStartProvider.cs index 5f582e3e..80b85fdc 100644 --- a/src/SyncTrayzor/Services/ProcessStartProvider.cs +++ b/src/SyncTrayzor/Services/ProcessStartProvider.cs @@ -35,13 +35,13 @@ public ProcessStartProvider(IAssemblyProvider assemblyProvider, IConfigurationPr public void Start(string filename) { - logger.Info("Starting {0}", filename); + logger.Debug("Starting {0}", filename); Process.Start(filename); } public void Start(string filename, string arguments) { - logger.Info("Starting {0} {1}", filename, arguments); + logger.Debug("Starting {0} {1}", filename, arguments); Process.Start(filename, arguments); } @@ -58,7 +58,7 @@ public void StartDetached(string filename, string arguments, string launchAfterF var launch = launchAfterFinished == null ? null : String.Format("--launch=\"{0}\"", launchAfterFinished.Replace("\"", "\\\"")); var formattedArguments = $"--shell {launch} -- \"{filename}\" {arguments}"; - logger.Info("Starting {0} {1}", processRunnerPath, formattedArguments); + logger.Debug("Starting {0} {1}", processRunnerPath, formattedArguments); var startInfo = new ProcessStartInfo() { FileName = processRunnerPath, @@ -78,7 +78,7 @@ public void StartElevatedDetached(string filename, string arguments, string laun var launch = launchAfterFinished == null ? null : String.Format("--launch=\"{0}\"", launchAfterFinished.Replace("\"", "\\\"")); var formattedArguments = $"--nowindow -- \"{processRunnerPath}\" --runas {launch} -- \"{filename}\" {arguments}"; - logger.Info("Starting {0} {1}", processRunnerPath, formattedArguments); + logger.Debug("Starting {0} {1}", processRunnerPath, formattedArguments); var startInfo = new ProcessStartInfo() { diff --git a/src/SyncTrayzor/Services/UpdateManagement/PortableUpdateVariantHandler.cs b/src/SyncTrayzor/Services/UpdateManagement/PortableUpdateVariantHandler.cs index 18ca8e91..679d0596 100644 --- a/src/SyncTrayzor/Services/UpdateManagement/PortableUpdateVariantHandler.cs +++ b/src/SyncTrayzor/Services/UpdateManagement/PortableUpdateVariantHandler.cs @@ -108,7 +108,7 @@ private async Task ExtractDownloadedZip(string zipPath) var destinationDir = Path.Combine(Path.GetDirectoryName(zipPath), Path.GetFileNameWithoutExtension(zipPath)); if (this.filesystem.DirectoryExists(destinationDir)) { - logger.Info($"Extracted directory {destinationDir} already exists. Deleting..."); + logger.Debug($"Extracted directory {destinationDir} already exists. Deleting..."); this.filesystem.DeleteDirectory(destinationDir, true); } diff --git a/src/SyncTrayzor/Services/UpdateManagement/UpdateDownloader.cs b/src/SyncTrayzor/Services/UpdateManagement/UpdateDownloader.cs index 98efd28e..f02cb965 100644 --- a/src/SyncTrayzor/Services/UpdateManagement/UpdateDownloader.cs +++ b/src/SyncTrayzor/Services/UpdateManagement/UpdateDownloader.cs @@ -157,7 +157,7 @@ private async Task TryDownloadToFileAsync(string downloadPath, string url) FormatUtils.BytesToHuman(p.BytesRead), FormatUtils.BytesToHuman(responseLength), (p.BytesRead * 100) / responseLength); if (downloadProgressString != previousDownloadProgressString) { - logger.Info(downloadProgressString); + logger.Debug(downloadProgressString); previousDownloadProgressString = downloadProgressString; } }); diff --git a/src/SyncTrayzor/Services/UpdateManagement/UpdateManager.cs b/src/SyncTrayzor/Services/UpdateManagement/UpdateManager.cs index de9fdcfe..8bbf751d 100644 --- a/src/SyncTrayzor/Services/UpdateManagement/UpdateManager.cs +++ b/src/SyncTrayzor/Services/UpdateManagement/UpdateManager.cs @@ -215,7 +215,7 @@ private async Task CheckForUpdatesAsync() // If another application is fullscreen, don't bother if (this.userActivityMonitor.IsWindowFullscreen()) { - logger.Info("Another application was fullscreen, so we didn't prompt the user"); + logger.Debug("Another application was fullscreen, so we didn't prompt the user"); return; } @@ -235,7 +235,7 @@ private async Task CheckForUpdatesAsync() catch (OperationCanceledException) { this.toastCts = null; - logger.Info("Update toast cancelled. Moving to a dialog"); + logger.Debug("Update toast cancelled. Moving to a dialog"); promptResult = this.updatePromptProvider.ShowDialog(checkResult, variantHandler.CanAutoInstall, variantHandler.RequiresUac); } } diff --git a/src/SyncTrayzor/Syncthing/ApiClient/SyncthingApiClient.cs b/src/SyncTrayzor/Syncthing/ApiClient/SyncthingApiClient.cs index 13f0b5ca..43be026e 100644 --- a/src/SyncTrayzor/Syncthing/ApiClient/SyncthingApiClient.cs +++ b/src/SyncTrayzor/Syncthing/ApiClient/SyncthingApiClient.cs @@ -34,7 +34,7 @@ public SyncthingApiClient(Uri baseAddress, string apiKey) public Task ShutdownAsync() { - logger.Info("Requesting API shutdown"); + logger.Debug("Requesting API shutdown"); return this.api.ShutdownAsync(); } @@ -112,13 +112,13 @@ public Task SetDebugFacilitiesAsync(IEnumerable enable, IEnumerable SendAsync(HttpRequestMessage { var response = await base.SendAsync(request, cancellationToken); if (response.IsSuccessStatusCode) - logger.Trace(() => response.Content.ReadAsStringAsync().Result.Trim()); + { + if (logger.IsTraceEnabled) + { + var content = (await response.Content.ReadAsStringAsync()).Trim(); + logger.Trace(content); + } + } else + { logger.Warn("Non-successful status code. {0} {1}", response, (await response.Content.ReadAsStringAsync()).Trim()); + } return response; } diff --git a/src/SyncTrayzor/Syncthing/EventWatcher/SyncthingEventWatcher.cs b/src/SyncTrayzor/Syncthing/EventWatcher/SyncthingEventWatcher.cs index 63e1418d..11b80dcd 100644 --- a/src/SyncTrayzor/Syncthing/EventWatcher/SyncthingEventWatcher.cs +++ b/src/SyncTrayzor/Syncthing/EventWatcher/SyncthingEventWatcher.cs @@ -108,7 +108,7 @@ await this.DoWithErrorHandlingAsync(() => { if (evt.IsValid) { - logger.Debug(evt); + logger.Trace(evt); evt.Visit(this); } else diff --git a/src/SyncTrayzor/Syncthing/SyncthingManager.cs b/src/SyncTrayzor/Syncthing/SyncthingManager.cs index 3a8ace54..2068d6fe 100644 --- a/src/SyncTrayzor/Syncthing/SyncthingManager.cs +++ b/src/SyncTrayzor/Syncthing/SyncthingManager.cs @@ -341,7 +341,7 @@ private async Task StartClientAsync() } catch (OperationCanceledException) // If Syncthing dies on its own, etc { - logger.Info("StartClientAsync aborted"); + logger.Debug("StartClientAsync aborted"); } catch (ApiException e) { diff --git a/src/SyncTrayzor/Syncthing/SyncthingPoller.cs b/src/SyncTrayzor/Syncthing/SyncthingPoller.cs index 31a550a5..f80d1083 100644 --- a/src/SyncTrayzor/Syncthing/SyncthingPoller.cs +++ b/src/SyncTrayzor/Syncthing/SyncthingPoller.cs @@ -127,7 +127,7 @@ protected async Task DoWithErrorHandlingAsync(Func action, Cancellat { // Anything else? // We can't abort, as then the exception will be lost. So log it, and keep going - logger.Error(e, "Unexpected exception while polling"); + logger.Warn(e, "Unexpected exception while polling"); errored = true; } diff --git a/src/SyncTrayzor/Syncthing/SyncthingProcessRunner.cs b/src/SyncTrayzor/Syncthing/SyncthingProcessRunner.cs index 11e46fd9..fa8b88e9 100644 --- a/src/SyncTrayzor/Syncthing/SyncthingProcessRunner.cs +++ b/src/SyncTrayzor/Syncthing/SyncthingProcessRunner.cs @@ -223,10 +223,10 @@ private void OnProcessExited() this.process = null; } - logger.Info("Syncthing process stopped with exit status {0}", exitStatus); + logger.Debug("Syncthing process stopped with exit status {0}", exitStatus); if (exitStatus == SyncthingExitStatus.Restarting || exitStatus == SyncthingExitStatus.Upgrading) { - logger.Info("Syncthing process requested restart, so restarting"); + logger.Debug("Syncthing process requested restart, so restarting"); this.OnProcessRestarted(); this.Start(); } From 48a6f3cf8b5e0bf59895fed53d9d125b64b1a821 Mon Sep 17 00:00:00 2001 From: Antony Male Date: Thu, 25 May 2017 21:52:40 +0100 Subject: [PATCH 03/29] Add option to change logging level, and default to Info I'm not having to debug issues from people's log files any more... Fixes #370 --- src/SyncTrayzor/Bootstrapper.cs | 2 +- .../Pages/Settings/SettingsView.xaml | 8 ++++- .../Pages/Settings/SettingsViewModel.cs | 27 +++++++++----- .../Properties/Resources.Designer.cs | 36 +++++++++++++++++++ src/SyncTrayzor/Properties/Resources.resx | 16 +++++++++ .../Services/Config/Configuration.cs | 5 ++- src/SyncTrayzor/Services/Config/LogLevel.cs | 15 ++++++++ .../Services/ConfigurationApplicator.cs | 28 +++++++++++++++ src/SyncTrayzor/SyncTrayzor.csproj | 1 + 9 files changed, 127 insertions(+), 11 deletions(-) create mode 100644 src/SyncTrayzor/Services/Config/LogLevel.cs diff --git a/src/SyncTrayzor/Bootstrapper.cs b/src/SyncTrayzor/Bootstrapper.cs index ff304303..f9634da2 100644 --- a/src/SyncTrayzor/Bootstrapper.cs +++ b/src/SyncTrayzor/Bootstrapper.cs @@ -100,7 +100,7 @@ protected override void Configure() var logger = LogManager.GetCurrentClassLogger(); var assembly = this.Container.Get(); - logger.Debug("SyncTrazor version {0} ({1}) started at {2} (.NET version: {3})", assembly.FullVersion, assembly.ProcessorArchitecture, assembly.Location, DotNetVersionFinder.FindDotNetVersion()); + logger.Info("SyncTrazor version {0} ({1}) started at {2} (.NET version: {3})", assembly.FullVersion, assembly.ProcessorArchitecture, assembly.Location, DotNetVersionFinder.FindDotNetVersion()); // This needs to happen before anything which might cause the unhandled exception stuff to be shown, as that wants to know // where to find the log file. diff --git a/src/SyncTrayzor/Pages/Settings/SettingsView.xaml b/src/SyncTrayzor/Pages/Settings/SettingsView.xaml index 5b2d0e12..474f1a23 100644 --- a/src/SyncTrayzor/Pages/Settings/SettingsView.xaml +++ b/src/SyncTrayzor/Pages/Settings/SettingsView.xaml @@ -213,11 +213,17 @@ -