public static void Main(string[] args)
        {
            try
            {
                // Will create a file logger before the database exists
                Log.Logger = LoggerConfig.CreateLogger();

                Log.Information("Starting Up");

                var host = CreateHostBuilder(args).Build();

                DatabaseConfig.SeedDatabases(host);

                // Will create a database logger now that the database exists
                Log.Logger = LoggerConfig.CreateLogger();

                host.Run();
            }
            catch (Exception exception)
            {
                Log.Fatal(exception, "Application start-up failed");
            }
            finally
            {
                Log.CloseAndFlush();
            }
        }
Exemple #2
0
 internal void BuildLogger()
 {
     this.logger = (global::Serilog.Core.Logger)LoggerConfig.CreateLogger()
                   .ForContext("SourceContext", this.nameOfLogger);
 }