1234567891011121314151617181920212223242526272829303132 |
- using CallCenter.Api;
- using Serilog;
- Log.Logger = new LoggerConfiguration()
- .WriteTo.Console()
- .CreateBootstrapLogger();
- Log.Information("Starting up");
- try
- {
- var builder = WebApplication.CreateBuilder(args);
- builder.Host.UseSerilog((ctx, lc) => lc
- //.WriteTo.Console(outputTemplate: "[{Timestamp:HH:mm:ss} {Level}] {SourceContext}{NewLine}{Message:lj}{NewLine}{Exception}{NewLine}")
- .Enrich.FromLogContext()
- .ReadFrom.Configuration(ctx.Configuration));
- builder
- .ConfigureServices()
- .ConfigurePipelines()
- .Run();
- }
- catch (Exception ex)
- {
- Log.Fatal(ex, "Unhandled exception");
- }
- finally
- {
- Log.Information("Shut down complete");
- Log.CloseAndFlush();
- }
|