using System;
using Microsoft.Extensions.Logging;

namespace ReallifeGamemode.Server.Log
{
  public class LogManager
  {
    public static ILoggerFactory Factory => LoggerFactory.Create(builder =>
    {
      builder.AddConsole();
      builder.AddDebug();
      builder.AddFilter("ReallifeGamemode.Server", LogLevel.Debug);
      builder.AddFilter("Microsoft.EntityFrameworkCore", LogLevel.Information);
      builder.AddFilter("Microsoft.EntityFrameworkCore.Infrastructure", LogLevel.Warning);
    });

    public static ILogger<T> GetLogger<T>()
    {
      return Factory.CreateLogger<T>();
    }

    public static ILogger GetLogger(Type type)
    {
      return Factory.CreateLogger(type.FullName);
    }
  }
}
