Skip to content
This repository has been archived by the owner on Jun 10, 2023. It is now read-only.

Commit

Permalink
remove some logging
Browse files Browse the repository at this point in the history
  • Loading branch information
j2ghz committed Aug 16, 2018
1 parent 6df1cf4 commit fa90ece
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 21 deletions.
12 changes: 3 additions & 9 deletions src/ModSink.Common/Client/ClientService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<FileSignature>.Create(required)
: Optional<FileSignature>.None;
})
(required, available) => !available.HasValue
? Optional<FileSignature>.Create(required)
: Optional<FileSignature>.None)
.Filter(opt => opt.HasValue)
.Transform(opt => opt.Value)
.InnerJoin(OnlineFiles.Connect(), of => of.FileSignature,
Expand Down
19 changes: 11 additions & 8 deletions src/ModSink.Common/Client/FileAccessService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public FileAccessService(DirectoryInfo localDir)
IEnumerable<FileSignature> IFileAccessService.FilesAvailable()
{
foreach (var fileInfo in localDir.EnumerateFiles()
//.Where(f => f.Name.EndsWith(".tmp"))
.Where(f => f.Name.EndsWith(".tmp"))
)
fileInfo.Delete();

Expand Down Expand Up @@ -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<IOException>()
.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<IOException>()
// .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)
Expand Down
1 change: 0 additions & 1 deletion src/ModSink.Common/Client/QueuedDownload.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public QueuedDownload(FileSignature fileSignature, Uri source)
{
FileSignature = fileSignature;
Source = source;
LogTo.Verbose("Created QueuedDownload for {signature}", fileSignature);
}
}
}
6 changes: 5 additions & 1 deletion src/ModSink.WPF/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ private void SetupLogging()
.Enrich.WithThreadId()
.MinimumLevel.Verbose()
.CreateLogger();

Log.Information("Log initialized");
if (!Debugger.IsAttached)
{
Expand Down Expand Up @@ -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();
}
}
}
}
3 changes: 3 additions & 0 deletions src/ModSink.WPF/ModSink.WPF.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
<ApplicationIcon>modsink_x3S_icon.ico</ApplicationIcon>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>DEBUG;TRACE</DefineConstants>
</PropertyGroup>

<ItemGroup>
<!-- App.xaml -->
Expand Down
2 changes: 0 additions & 2 deletions src/ModSink.WPF/ViewModel/DownloadViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ public void Dispose()

private ObservableAsPropertyHelper<T> LogErrorsAndDispose<T>(ObservableAsPropertyHelper<T> oaph)
{
oaph.ThrownExceptions.Subscribe(e =>
LogTo.Error(e, "[{download}] failed", Name));
oaph.DisposeWith(disposable);
return oaph;
}
Expand Down

0 comments on commit fa90ece

Please sign in to comment.