Ready to test v2.43.0
This commit is contained in:
		
							
								
								
									
										36
									
								
								Adaptation/_Tests/Shared/Log/ConsoleLogger.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								Adaptation/_Tests/Shared/Log/ConsoleLogger.cs
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,36 @@ | ||||
| using Microsoft.Extensions.Logging; | ||||
| using System; | ||||
|  | ||||
| namespace Adaptation._Tests.Shared.Log; | ||||
|  | ||||
| public class ConsoleLogger : ILogger | ||||
| { | ||||
|  | ||||
|     public int EventId { get; set; } | ||||
|  | ||||
|     private readonly string _Name; | ||||
|     private readonly LogLevel _LogLevel; | ||||
|  | ||||
|     public ConsoleLogger(LogLevel logLevel, string name) | ||||
|     { | ||||
|         _Name = name; | ||||
|         EventId = 0; | ||||
|         _LogLevel = logLevel; | ||||
|         if (string.IsNullOrEmpty(_Name)) | ||||
|         { } | ||||
|     } | ||||
|  | ||||
|     public IDisposable BeginScope<TState>(TState state) => null; | ||||
|  | ||||
|     public bool IsEnabled(LogLevel logLevel) => logLevel >= _LogLevel; | ||||
|  | ||||
|     public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter) | ||||
|     { | ||||
|         if (IsEnabled(logLevel) && (EventId == 0 || EventId == eventId.Id)) | ||||
|         { | ||||
|             string message = formatter(state, null); | ||||
|             Console.WriteLine(message); | ||||
|         } | ||||
|     } | ||||
|  | ||||
| } | ||||
		Reference in New Issue
	
	Block a user