Files
Adaptation
.config
.vscode
Eaf
FileHandlers
Ifx
Infineon
PeerGroup
Shared
_Tests
CreateSelfDescription
Extract
Shared
Log
ConsoleLogger.cs
ConsoleProvider.cs
DebugLogger.cs
DebugProvider.cs
FeedbackLogger.cs
FeedbackProvider.cs
IFeedback.cs
Log.cs
PasteSpecialXml
AdaptationTesting.cs
EAFLoggingUnitTesting.cs
IsEnvironment.cs
LoggingUnitTesting.cs
MethodBaseName.cs
UnitTesting.cs
Static
.editorconfig
MET08THFTIRQS408M-Development.yml
MET08THFTIRQS408M.Tests.csproj
MET08THFTIRQS408M.yml
appsettings.Development.json
appsettings.json
package.json
FileHandlers
Properties
Shared
.gitignore
MET08THFTIRQS408M.csproj
README.md
met08thftirqs408m/Adaptation/_Tests/Shared/Log/ConsoleProvider.cs
Mike Phares 72a9f902bc MET08THFTIRQS408M - v2.43.0 - Using EDA
Multiple Storage Paths and delete old way
2022-06-07 11:13:11 -07:00

27 lines
693 B
C#

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