birbmap/Birdmap.API/Program.cs

46 lines
1.3 KiB
C#
Raw Normal View History

2020-10-21 11:05:17 +02:00
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using NLog;
using NLog.Web;
using System;
2020-10-21 11:05:17 +02:00
namespace Birdmap
{
public class Program
{
public static void Main(string[] args)
{
var logger = NLogBuilder.ConfigureNLog("NLog.config").GetCurrentClassLogger();
try
{
logger.Debug("Main called...");
CreateHostBuilder(args).Build().Run();
}
catch (Exception ex)
{
logger.Error(ex, "Exception occurred in Main.");
throw;
}
finally
{
LogManager.Shutdown();
}
2020-10-21 11:05:17 +02:00
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
}).ConfigureLogging(logging =>
{
logging.ClearProviders();
logging.AddConsole();
logging.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Trace);
})
.UseNLog();
2020-10-21 11:05:17 +02:00
}
}