forked from amkovkov/GranuSightSoftware2
20 lines
487 B
C#
20 lines
487 B
C#
using Microsoft.Extensions.Logging;
|
|
|
|
namespace GSS2.Core.Logging;
|
|
|
|
public sealed class FileLoggerProvider : ILoggerProvider
|
|
{
|
|
private readonly string _filePath;
|
|
|
|
public FileLoggerProvider(string filePath, bool append = true)
|
|
{
|
|
_filePath = filePath;
|
|
if (!append && File.Exists(filePath))
|
|
File.Create(filePath);
|
|
}
|
|
|
|
public ILogger CreateLogger(string categoryName) => new FileLogger(categoryName, _filePath);
|
|
|
|
public void Dispose() { }
|
|
}
|