aboutsummaryrefslogtreecommitdiff
path: root/src/Web/DevHive.Web/Program.cs
diff options
context:
space:
mode:
authortranstrike <transtrike@gmail.com>2021-04-02 23:17:39 +0300
committertranstrike <transtrike@gmail.com>2021-04-02 23:17:39 +0300
commit0c83049a3a0b417da7dcd548b1cd0992defb366f (patch)
treeb69ef0d111b7c22316a2a6603d66d85e4a568956 /src/Web/DevHive.Web/Program.cs
parentd672c515eb760a5351affeb5600640569ed5ee16 (diff)
parent2448c4d31188aed26605c5e3c282bacc3bd71ae5 (diff)
downloadDevHive-0c83049a3a0b417da7dcd548b1cd0992defb366f.tar
DevHive-0c83049a3a0b417da7dcd548b1cd0992defb366f.tar.gz
DevHive-0c83049a3a0b417da7dcd548b1cd0992defb366f.zip
dev -> feature/profile_picture_implementation(02.03.2021)
Diffstat (limited to 'src/Web/DevHive.Web/Program.cs')
-rw-r--r--src/Web/DevHive.Web/Program.cs26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/Web/DevHive.Web/Program.cs b/src/Web/DevHive.Web/Program.cs
index fdb6889..e7c47a9 100644
--- a/src/Web/DevHive.Web/Program.cs
+++ b/src/Web/DevHive.Web/Program.cs
@@ -1,5 +1,8 @@
+using System;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
+using Microsoft.Extensions.Configuration;
+using Serilog;
namespace DevHive.Web
{
@@ -11,11 +14,32 @@ namespace DevHive.Web
public static void Main(string[] args)
{
- CreateHostBuilder(args).Build().Run();
+ var config = new ConfigurationBuilder()
+ .AddJsonFile("appsettings.json")
+ .Build();
+
+ Log.Logger = new LoggerConfiguration()
+ .ReadFrom.Configuration(config)
+ .CreateLogger();
+
+ try
+ {
+ Log.Information("Application Starting Up");
+ CreateHostBuilder(args).Build().Run();
+ }
+ catch (Exception ex)
+ {
+ Log.Fatal(ex, "The application failed to start correctly.");
+ }
+ finally
+ {
+ Log.CloseAndFlush();
+ }
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
+ .UseSerilog()
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.ConfigureKestrel(opt => opt.ListenLocalhost(HTTP_PORT));