Files
MTSC/MTSC.OAuth2/Models/ServerDebugLogger.cs
amacocian 0fe9f9957c Setup OAuth2 support (#20)
* Setup OAuth2 support

* Setup tests project

* Setup OAuth2 unit tests in CI pipeline

* Setup authorizeattribute tests

* Test

* Setup tests for AuthorizeAttribute

* Setup OAuth2 support
Unit Tests coverage

* Add OAuth2 project to release
2022-09-02 16:13:08 +02:00

30 lines
779 B
C#

using Microsoft.Extensions.Logging;
using MTSC.ServerSide;
using System;
namespace MTSC.OAuth2.Models
{
internal sealed class ServerDebugLogger<T> : ILogger<T>
{
private readonly Server server;
public ServerDebugLogger(Server server)
{
this.server = server;
}
public IDisposable BeginScope<TState>(TState state)
{
throw new NotImplementedException();
}
public bool IsEnabled(LogLevel logLevel) => true;
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter)
{
var message = formatter(state, exception);
this.server.LogDebug(message);
}
}
}