using System;
using Microsoft.Extensions.Logging;

namespace ScaffoldDemo
{
    public class SqlLogger : ILogger
    {
        public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter)
        {
            if (eventId.Name == "Microsoft.EntityFrameworkCore.Database.Command.CommandExecuting")
            {
                Console.WriteLine(state);
            }
        }

        public bool IsEnabled(LogLevel logLevel)
        {
            return true;
        }

        public IDisposable BeginScope<TState>(TState state)
        {
            return null;
        }
    }
}