-
-
Notifications
You must be signed in to change notification settings - Fork 96
/
Program.cs
34 lines (30 loc) · 899 Bytes
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using HappyCode.NetCoreBoilerplate.Api;
using HappyCode.NetCoreBoilerplate.Api.Infrastructure.Configurations;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
using Serilog;
Log.Logger = SerilogConfigurator.CreateLogger();
try
{
BannerConfigurator.Print(!Console.IsOutputRedirected);
Log.Logger.Information("Starting up...");
using var webHost = CreateWebHostBuilder(args).Build();
await webHost.RunAsync();
Log.Logger.Debug("I'm done, see ya later!");
}
catch (Exception ex)
{
Log.Logger.Fatal(ex, "Application start-up failed");
throw;
}
finally
{
Log.CloseAndFlush();
}
static IHostBuilder CreateWebHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.UseSerilog()
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});