mirror of
https://github.com/Jetsparrow/jetherald.git
synced 2026-01-20 23:56:08 +03:00
50 lines
1.4 KiB
C#
50 lines
1.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.AspNetCore;
|
|
using Microsoft.AspNetCore.Hosting;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.Logging;
|
|
using NLog.Web;
|
|
|
|
namespace JetHerald
|
|
{
|
|
public class Program
|
|
{
|
|
public static void Main(string[] args)
|
|
{
|
|
var logger = NLog.Web.NLogBuilder.ConfigureNLog("NLog.config").GetCurrentClassLogger();
|
|
try
|
|
{
|
|
logger.Debug("init main");
|
|
CreateWebHostBuilder(args).Build().Run();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
logger.Error(ex, "Stopped program because of exception");
|
|
throw;
|
|
}
|
|
finally
|
|
{
|
|
NLog.LogManager.Shutdown();
|
|
}
|
|
}
|
|
|
|
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
|
|
WebHost.CreateDefaultBuilder(args)
|
|
.UseStartup<Startup>()
|
|
.ConfigureAppConfiguration(config =>
|
|
{
|
|
config.AddIniFile("secrets.ini");
|
|
})
|
|
.ConfigureLogging(logging =>
|
|
{
|
|
logging.ClearProviders();
|
|
logging.SetMinimumLevel(LogLevel.Trace);
|
|
})
|
|
.UseNLog(); // NLog: setup NLog for Dependency injection
|
|
}
|
|
}
|