mhf-server/Mhf.Server/Web/Server/Kestrel/KestrelLoggerProvider.cs
2019-11-24 19:43:35 +08:00

26 lines
625 B
C#

using System.Collections.Concurrent;
using Microsoft.Extensions.Logging;
namespace Mhf.Server.Web.Server.Kestrel
{
public class KestrelLoggerProvider: ILoggerProvider
{
private readonly ConcurrentDictionary<string, KestrelLogger> _loggers = new ConcurrentDictionary<string, KestrelLogger>();
public KestrelLoggerProvider()
{
}
public ILogger CreateLogger(string categoryName)
{
return _loggers.GetOrAdd(categoryName, name => new KestrelLogger(name));
}
public void Dispose()
{
_loggers.Clear();
}
}
}