The next generation of the Teknik Services. Written in ASP.NET.
https://www.teknik.io/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
763 B
30 lines
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(); |
|
} |
|
} |
|
}
|
|
|