mirror of
https://github.com/dotnetcore/AgileConfig.git
synced 2026-10-27 11:44:41 +08:00
35 lines
850 B
C#
35 lines
850 B
C#
using Microsoft.Extensions.Logging;
|
|
using System;
|
|
|
|
namespace AgileConfig.Server.Common
|
|
{
|
|
public class EfLoggerProvider : ILoggerProvider
|
|
{
|
|
public ILogger CreateLogger(string categoryName)
|
|
{
|
|
return new EfLogger();
|
|
}
|
|
|
|
public void Dispose()
|
|
{ }
|
|
|
|
private class EfLogger : ILogger
|
|
{
|
|
public bool IsEnabled(LogLevel logLevel)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter)
|
|
{
|
|
Console.WriteLine(formatter(state, exception));
|
|
}
|
|
|
|
public IDisposable BeginScope<TState>(TState state)
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
}
|
|
}
|