mirror of
https://github.com/meysamhadeli/booking-microservices.git
synced 2026-04-27 16:10:52 +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()
|
.Enrich.FromLogContext()
|
||||||
.ReadFrom.Configuration(context.Configuration);
|
.ReadFrom.Configuration(context.Configuration);
|
||||||
|
|
||||||
if (logOptions.Elastic.Enable)
|
if (logOptions.Elastic is { Enable: true })
|
||||||
{
|
{
|
||||||
loggerConfiguration.WriteTo.Elasticsearch(
|
loggerConfiguration.WriteTo.Elasticsearch(
|
||||||
new ElasticsearchSinkOptions(new Uri(logOptions.Elastic.ElasticServiceUrl))
|
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;
|
var path = string.IsNullOrWhiteSpace(logOptions.File.Path) ? "logs/.txt" : logOptions.File.Path;
|
||||||
if (!Enum.TryParse<RollingInterval>(logOptions.File.Interval, true, out var interval))
|
if (!Enum.TryParse<RollingInterval>(logOptions.File.Interval, true, out var interval))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user