public static async Task Main(string[] args) { Log.Logger = SerilogLoggerFactory.CreateLogger(); try { Log.Information($"Starting ratesApi. Environment: '{EnvironmentHelpers.GetEnvironmentName()}'"); var host = CreateHostBuilder(args).Build(); using (var scope = host.Services.CreateScope()) { var context = scope.ServiceProvider.GetRequiredService <RatesDataContext>(); await context.Database.MigrateAsync(); } await host.RunAsync(); } catch (Exception exc) { Log.Fatal(exc, "Error during ratesApi startup."); throw; } finally { Log.CloseAndFlush(); } }
static async Task Main(string[] args) { Log.Logger = SerilogLoggerFactory.CreateLogger(); try { Log.Information($"Starting bot. Environment: '{EnvironmentHelpers.GetEnvironmentName()}'"); await CreateHostBuilder(args).Build().RunAsync(); } catch (Exception exc) { Log.Fatal(exc, "Error during bot startup."); throw; } finally { Log.CloseAndFlush(); } }