mirror of
https://github.com/meysamhadeli/booking-microservices.git
synced 2026-04-13 20:18:36 +08:00
Merge pull request #49 from meysamhadeli/develop
fix bug null exception in AddCustomSerilog
This commit is contained in:
commit
f6785d4b0f
@ -37,7 +37,7 @@ namespace BuildingBlocks.Logging
|
||||
.Enrich.FromLogContext()
|
||||
.ReadFrom.Configuration(context.Configuration);
|
||||
|
||||
if (logOptions.Elastic.Enable)
|
||||
if (logOptions.Elastic is { Enable: true })
|
||||
{
|
||||
loggerConfiguration.WriteTo.Elasticsearch(
|
||||
new ElasticsearchSinkOptions(new Uri(logOptions.Elastic.ElasticServiceUrl))
|
||||
@ -48,7 +48,7 @@ namespace BuildingBlocks.Logging
|
||||
});
|
||||
}
|
||||
|
||||
if (logOptions.File.Enable)
|
||||
if (logOptions.File is { Enable: true })
|
||||
{
|
||||
var path = string.IsNullOrWhiteSpace(logOptions.File.Path) ? "logs/.txt" : logOptions.File.Path;
|
||||
if (!Enum.TryParse<RollingInterval>(logOptions.File.Interval, true, out var interval))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user