mirror of
https://github.com/rmcrackan/Libation.git
synced 2026-01-13 08:19:31 -05:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0f7ffacdf8 | ||
|
|
829b35c5a8 | ||
|
|
614b05d5ff |
@@ -2,7 +2,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<Version>12.4.8.1</Version>
|
||||
<Version>12.4.9.1</Version>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Octokit" Version="14.0.0" />
|
||||
|
||||
@@ -118,6 +118,7 @@ namespace FileLiberator
|
||||
}
|
||||
catch when (cancellationToken.IsCancellationRequested)
|
||||
{
|
||||
Serilog.Log.Logger.Information("Download/Decrypt was cancelled. {@Book}", libraryBook.LogFriendly());
|
||||
return new StatusHandler { "Cancelled" };
|
||||
}
|
||||
finally
|
||||
|
||||
@@ -5,6 +5,8 @@ using FileManager;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Serilog;
|
||||
using Serilog.Events;
|
||||
using Serilog.Exceptions;
|
||||
using Serilog.Settings.Configuration;
|
||||
|
||||
#nullable enable
|
||||
namespace LibationFileManager
|
||||
@@ -15,11 +17,25 @@ namespace LibationFileManager
|
||||
|
||||
public void ConfigureLogging()
|
||||
{
|
||||
//pass explicit assemblies to the ConfigurationReaderOptions
|
||||
//This is a workaround for the issue where serilog will try to load all
|
||||
//Assemblies starting with "serilog" from the app folder, but it will fail
|
||||
//if those assemblies are unreferenced.
|
||||
//This was a problem when migrating from the ZipFile sink to the File sink.
|
||||
//Upgrading users would still have the ZipFile sink dll in the program
|
||||
//folder and serilog would try to load it, unsuccessfully.
|
||||
//https://github.com/serilog/serilog-settings-configuration/issues/406
|
||||
var readerOptions = new ConfigurationReaderOptions(
|
||||
typeof(ILogger).Assembly, // Serilog
|
||||
typeof(LoggerEnrichmentConfigurationExtensions).Assembly, // Serilog.Exceptions
|
||||
typeof(ConsoleLoggerConfigurationExtensions).Assembly, // Serilog.Sinks.Console
|
||||
typeof(FileLoggerConfigurationExtensions).Assembly); // Serilog.Sinks.File
|
||||
|
||||
configuration = new ConfigurationBuilder()
|
||||
.AddJsonFile(SettingsFilePath, optional: false, reloadOnChange: true)
|
||||
.Build();
|
||||
Log.Logger = new LoggerConfiguration()
|
||||
.ReadFrom.Configuration(configuration)
|
||||
.ReadFrom.Configuration(configuration, readerOptions)
|
||||
.Destructure.ByTransforming<LongPath>(lp => lp.Path)
|
||||
.Destructure.With<LogFileFilter>()
|
||||
.CreateLogger();
|
||||
|
||||
Reference in New Issue
Block a user