20 lines
449 B
C#
20 lines
449 B
C#
using System.Collections.Concurrent;
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
namespace SimApi.Logger;
|
|
|
|
public class SimApiLoggerProvider : ILoggerProvider
|
|
{
|
|
private readonly ConcurrentDictionary<string, SimApiLogger> _loggers = new();
|
|
|
|
|
|
public ILogger CreateLogger(string categoryName)
|
|
{
|
|
return _loggers.GetOrAdd(categoryName, name => new SimApiLogger(name));
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
_loggers.Clear();
|
|
}
|
|
} |