Added docker-compose. Updated startups for API and Web layer.
This commit is contained in:
@@ -1,9 +1,31 @@
|
||||
using Serilog;
|
||||
using Serilog.Events;
|
||||
|
||||
namespace JSMR.Api.Startup;
|
||||
|
||||
public static class HostBuilderExtensions
|
||||
{
|
||||
public static IHostBuilder UseAppSerilog(this IHostBuilder host)
|
||||
=> host.UseSerilog();
|
||||
{
|
||||
return host.UseSerilog((context, services, loggerConfiguration) =>
|
||||
{
|
||||
IConfiguration configuration = context.Configuration;
|
||||
IHostEnvironment environment = context.HostingEnvironment;
|
||||
|
||||
loggerConfiguration
|
||||
.ReadFrom.Configuration(configuration)
|
||||
.ReadFrom.Services(services)
|
||||
.MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
|
||||
.Enrich.WithProperty("Service", "JSMR.Api")
|
||||
.Enrich.WithProperty("Environment", environment.EnvironmentName);
|
||||
|
||||
// Conditionally add Seq if configured correctly
|
||||
string? seqUrl = configuration["Seq:ServerUrl"];
|
||||
|
||||
if (Uri.TryCreate(seqUrl, UriKind.Absolute, out _))
|
||||
{
|
||||
loggerConfiguration.WriteTo.Seq(seqUrl);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user