This commit is contained in:
2026-02-11 20:04:54 +01:00
parent a85cea0374
commit 1a44f01d28

View File

@@ -14,7 +14,7 @@ using System.Threading.Channels;
using System.Threading.Tasks; using System.Threading.Tasks;
[ProviderAlias("EonaCatFileLogger")] [ProviderAlias("EonaCatFileLogger")]
public sealed class AsyncFileLoggerProvider : ILoggerProvider public sealed class FileLoggerProvider : ILoggerProvider
{ {
private readonly string _path; private readonly string _path;
private readonly string _fileNamePrefix; private readonly string _fileNamePrefix;
@@ -32,6 +32,8 @@ public sealed class AsyncFileLoggerProvider : ILoggerProvider
public bool IncludeCorrelationId { get; } public bool IncludeCorrelationId { get; }
public bool EnableCategoryRouting { get; } public bool EnableCategoryRouting { get; }
public string LogFile => _files.TryGetValue(string.Empty, out var state) ? state.FilePath : string.Empty;
private sealed class FileState private sealed class FileState
{ {
public FileStream Stream; public FileStream Stream;
@@ -42,7 +44,7 @@ public sealed class AsyncFileLoggerProvider : ILoggerProvider
public string FilePath; public string FilePath;
} }
public AsyncFileLoggerProvider(IOptions<FileLoggerOptions> options) public FileLoggerProvider(IOptions<FileLoggerOptions> options)
{ {
var o = options.Value ?? throw new ArgumentNullException(nameof(options)); var o = options.Value ?? throw new ArgumentNullException(nameof(options));