Files
.vscode
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
DEP08SIHTRPLC-Development.yml
DEP08SIHTRPLC.Tests.csproj
DEP08SIHTRPLC.yml
appsettings.Development.json
appsettings.json
package.json
FileHandlers
Properties
Shared
.gitignore
DEP08SIHTRPLC.csproj
README.md

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