Files
simapi-net/Logger/SimApiLoggerProvider.cs
T

20 lines
449 B
C#
Raw Normal View History

2021-06-28 05:36:54 +08:00
using System.Collections.Concurrent;
using Microsoft.Extensions.Logging;
2024-03-23 07:29:43 +08:00
namespace SimApi.Logger;
public class SimApiLoggerProvider : ILoggerProvider
2021-06-28 05:36:54 +08:00
{
2024-03-23 07:29:43 +08:00
private readonly ConcurrentDictionary<string, SimApiLogger> _loggers = new();
public ILogger CreateLogger(string categoryName)
2021-06-28 05:36:54 +08:00
{
2024-03-23 07:29:43 +08:00
return _loggers.GetOrAdd(categoryName, name => new SimApiLogger(name));
}
2021-06-28 05:36:54 +08:00
2024-03-23 07:29:43 +08:00
public void Dispose()
{
_loggers.Clear();
2021-06-28 05:36:54 +08:00
}
}