The next generation of the Teknik Services. Written in ASP.NET. https://www.teknik.io/
您最多能選擇 25 個主題 主題必須以字母或數字為開頭,可包含連接號「-」且最長為 35 個字元。

31 行
763 B

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();
}
}
}