40 lines
1.2 KiB
C#
40 lines
1.2 KiB
C#
using Microsoft.Extensions.Logging;
|
|
using System;
|
|
using System.IO;
|
|
|
|
namespace rockfishCore.Util
|
|
{
|
|
//from a comment here: https://github.com/aspnet/EntityFramework/issues/6482
|
|
|
|
public class rfLoggerProvider : ILoggerProvider
|
|
{
|
|
public ILogger CreateLogger(string categoryName)
|
|
{
|
|
return new rfLogger();
|
|
}
|
|
|
|
public void Dispose()
|
|
{ }
|
|
|
|
private class rfLogger : 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)
|
|
{
|
|
// File.AppendAllText(@"log.txt", formatter(state, exception));
|
|
Console.WriteLine("------------------------------------------------------------");
|
|
Console.WriteLine(formatter(state, exception));
|
|
Console.WriteLine("------------------------------------------------------------");
|
|
}
|
|
|
|
public IDisposable BeginScope<TState>(TState state)
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
}
|
|
} |