mirror of
https://github.com/AlexMacocian/SystemExtensions.git
synced 2026-07-16 06:29:29 +00:00
e6a06915cd
Codestyle fixes Setup CODEOWNERS Setup dependabot
26 lines
689 B
C#
26 lines
689 B
C#
using Microsoft.Extensions.Logging;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace SystemExtensions.NetStandard.Tests.Logging.Models;
|
|
|
|
public sealed class CachingLogger<T> : ILogger<T>
|
|
{
|
|
public List<string> LogCache { get; } = new();
|
|
|
|
public IDisposable BeginScope<TState>(TState state)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public bool IsEnabled(LogLevel logLevel)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter)
|
|
{
|
|
var message = formatter(state, exception);
|
|
this.LogCache.Add(message);
|
|
}
|
|
} |