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
27 lines
693 B
C#
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);
|
|
}
|
|
|
|
} |