mirror of
https://git.teknik.io/Teknikode/Teknik.git
synced 2023-08-02 14:16:22 +02:00
31 lines
763 B
C#
31 lines
763 B
C#
|
using Microsoft.Extensions.Logging;
|
|||
|
using System;
|
|||
|
using System.Collections.Concurrent;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Text;
|
|||
|
using Teknik.Configuration;
|
|||
|
|
|||
|
namespace Teknik.Logging
|
|||
|
{
|
|||
|
public class LoggerProvider : ILoggerProvider
|
|||
|
{
|
|||
|
private readonly Config _config;
|
|||
|
private readonly ConcurrentDictionary<string, Logger> _loggers = new ConcurrentDictionary<string, Logger>();
|
|||
|
|
|||
|
public LoggerProvider(Config config)
|
|||
|
{
|
|||
|
_config = config;
|
|||
|
}
|
|||
|
|
|||
|
public ILogger CreateLogger(string categoryName)
|
|||
|
{
|
|||
|
return _loggers.GetOrAdd(categoryName, name => new Logger(name, _config));
|
|||
|
}
|
|||
|
|
|||
|
public void Dispose()
|
|||
|
{
|
|||
|
_loggers.Clear();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|