From fa90eceb12ede1002ef7ed659cf1b462664ab351 Mon Sep 17 00:00:00 2001 From: J2ghz Date: Thu, 16 Aug 2018 12:04:42 +0200 Subject: [PATCH] remove some logging --- src/ModSink.Common/Client/ClientService.cs | 12 +++--------- .../Client/FileAccessService.cs | 19 +++++++++++-------- src/ModSink.Common/Client/QueuedDownload.cs | 1 - src/ModSink.WPF/App.xaml.cs | 6 +++++- src/ModSink.WPF/ModSink.WPF.csproj | 3 +++ .../ViewModel/DownloadViewModel.cs | 2 -- 6 files changed, 22 insertions(+), 21 deletions(-) diff --git a/src/ModSink.Common/Client/ClientService.cs b/src/ModSink.Common/Client/ClientService.cs index 683cc598..f0a29795 100644 --- a/src/ModSink.Common/Client/ClientService.cs +++ b/src/ModSink.Common/Client/ClientService.cs @@ -47,15 +47,9 @@ public ClientService(IDownloader downloader, IFormatter serializationFormatter, .DisposeWith(disposable) .Connect() .LeftJoin(filesAvailable.Connect(), f => f, - (required, available) => - { - LogTo.Verbose( - available.HasValue ? "File {signature} is available" : "File {signature} is not available", - required); - return !available.HasValue - ? Optional.Create(required) - : Optional.None; - }) + (required, available) => !available.HasValue + ? Optional.Create(required) + : Optional.None) .Filter(opt => opt.HasValue) .Transform(opt => opt.Value) .InnerJoin(OnlineFiles.Connect(), of => of.FileSignature, diff --git a/src/ModSink.Common/Client/FileAccessService.cs b/src/ModSink.Common/Client/FileAccessService.cs index 9bc3435b..da664373 100644 --- a/src/ModSink.Common/Client/FileAccessService.cs +++ b/src/ModSink.Common/Client/FileAccessService.cs @@ -23,7 +23,7 @@ public FileAccessService(DirectoryInfo localDir) IEnumerable IFileAccessService.FilesAvailable() { foreach (var fileInfo in localDir.EnumerateFiles() - //.Where(f => f.Name.EndsWith(".tmp")) + .Where(f => f.Name.EndsWith(".tmp")) ) fileInfo.Delete(); @@ -57,13 +57,16 @@ public void TemporaryFinished(FileSignature fileSignature) var final = GetFileInfo(fileSignature, false); LogTo.Verbose("Renaming file {src} to {dst}", temp, final); - Policy - .Handle() - .WaitAndRetry(5, i => Math.Pow(2, i).Seconds(), - (exception, duration) => LogTo.Warning(exception, - "Moving file from {src} to {dst} has failed after {duration}", temp.FullName, final.FullName, - duration)) - .Execute(() => temp.MoveTo(final.FullName)); + //Policy + // .Handle() + // .WaitAndRetry(5, i => Math.Pow(2, i).Seconds(), + // (exception, duration) => LogTo.Warning(exception, + // "Moving file from {src} to {dst} has failed after {duration}", temp.FullName, final.FullName, + // duration)) + // .Execute(() => + // { + temp.MoveTo(final.FullName); + //}); } private FileInfo GetFileInfo(FileSignature fileSignature, bool temporary) diff --git a/src/ModSink.Common/Client/QueuedDownload.cs b/src/ModSink.Common/Client/QueuedDownload.cs index 78244b2f..20311921 100644 --- a/src/ModSink.Common/Client/QueuedDownload.cs +++ b/src/ModSink.Common/Client/QueuedDownload.cs @@ -15,7 +15,6 @@ public QueuedDownload(FileSignature fileSignature, Uri source) { FileSignature = fileSignature; Source = source; - LogTo.Verbose("Created QueuedDownload for {signature}", fileSignature); } } } diff --git a/src/ModSink.WPF/App.xaml.cs b/src/ModSink.WPF/App.xaml.cs index e550ce4b..a5b375b2 100644 --- a/src/ModSink.WPF/App.xaml.cs +++ b/src/ModSink.WPF/App.xaml.cs @@ -96,6 +96,7 @@ private void SetupLogging() .Enrich.WithThreadId() .MinimumLevel.Verbose() .CreateLogger(); + Log.Information("Log initialized"); if (!Debugger.IsAttached) { @@ -126,7 +127,10 @@ private void SetupLogging() Countly.UserDetails.Username = Environment.UserName; Countly.UserDetails.Organization = Environment.MachineName; Countly.StartSession("https://countly.j2ghz.com", "54c6bf3a77021fadb7bd5b2a66490b465d4382ac", FullVersion); - DispatcherMonitor.Start(); + if (!Debugger.IsAttached) + { + DispatcherMonitor.Start(); + } } } } \ No newline at end of file diff --git a/src/ModSink.WPF/ModSink.WPF.csproj b/src/ModSink.WPF/ModSink.WPF.csproj index ec35281e..acc05eb9 100644 --- a/src/ModSink.WPF/ModSink.WPF.csproj +++ b/src/ModSink.WPF/ModSink.WPF.csproj @@ -12,6 +12,9 @@ modsink_x3S_icon.ico AnyCPU + + DEBUG;TRACE + diff --git a/src/ModSink.WPF/ViewModel/DownloadViewModel.cs b/src/ModSink.WPF/ViewModel/DownloadViewModel.cs index e5d57259..cd0a582f 100644 --- a/src/ModSink.WPF/ViewModel/DownloadViewModel.cs +++ b/src/ModSink.WPF/ViewModel/DownloadViewModel.cs @@ -71,8 +71,6 @@ public void Dispose() private ObservableAsPropertyHelper LogErrorsAndDispose(ObservableAsPropertyHelper oaph) { - oaph.ThrownExceptions.Subscribe(e => - LogTo.Error(e, "[{download}] failed", Name)); oaph.DisposeWith(disposable); return oaph; }