DEP08SIHTRPLC - v2.43.0 - Ready to Test
This commit is contained in:
27
Adaptation/_Tests/Shared/Log/ConsoleProvider.cs
Normal file
27
Adaptation/_Tests/Shared/Log/ConsoleProvider.cs
Normal file
@ -0,0 +1,27 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
|
||||
namespace Adaptation._Tests.Shared.Log;
|
||||
|
||||
public class ConsoleProvider : ILoggerProvider
|
||||
{
|
||||
|
||||
private readonly LogLevel _LogLevel;
|
||||
private readonly ConcurrentDictionary<string, ConsoleLogger> _Loggers;
|
||||
|
||||
public ConsoleProvider(LogLevel logLevel)
|
||||
{
|
||||
_LogLevel = logLevel;
|
||||
_Loggers = new ConcurrentDictionary<string, ConsoleLogger>();
|
||||
}
|
||||
|
||||
public ILogger CreateLogger(string categoryName) => _Loggers.GetOrAdd(categoryName, name => new ConsoleLogger(_LogLevel, name));
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_Loggers.Clear();
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user