From 24e550d6122fbf840c1998110ab3747d678fcc4c Mon Sep 17 00:00:00 2001 From: Ruberoid Date: Tue, 22 Jul 2025 20:29:46 +0300 Subject: [PATCH] fixed output template for logging. --- .../Infrastructure/HostBuilderFactory.cs | 2 +- .../Infrastructure/ShortSourceContextEnricher.cs | 2 +- src/Nocr.TelegramListener.Host/appsettings.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Nocr.TelegramListener.Host/Infrastructure/HostBuilderFactory.cs b/src/Nocr.TelegramListener.Host/Infrastructure/HostBuilderFactory.cs index 33ee306..89b00e5 100644 --- a/src/Nocr.TelegramListener.Host/Infrastructure/HostBuilderFactory.cs +++ b/src/Nocr.TelegramListener.Host/Infrastructure/HostBuilderFactory.cs @@ -13,7 +13,7 @@ public class HostBuilderFactory where TStartup : class if (!string.IsNullOrWhiteSpace(baseDirectory)) configurationBuilder.SetBasePath(baseDirectory); - configurationBuilder.AddJsonFile("appsettings.protected.json", optional: true); + configurationBuilder.AddJsonFile("appsettings.protected.json", optional: true, reloadOnChange: true); }) .UseSerilog((ctx, logBuilder) => { diff --git a/src/Nocr.TelegramListener.Host/Infrastructure/ShortSourceContextEnricher.cs b/src/Nocr.TelegramListener.Host/Infrastructure/ShortSourceContextEnricher.cs index 45254ad..22fbf25 100644 --- a/src/Nocr.TelegramListener.Host/Infrastructure/ShortSourceContextEnricher.cs +++ b/src/Nocr.TelegramListener.Host/Infrastructure/ShortSourceContextEnricher.cs @@ -7,7 +7,7 @@ public class ShortSourceContextEnricher : ILogEventEnricher { if (logEvent.Properties.TryGetValue("SourceContext", out var sourceContextValue)) { - var fullName = sourceContextValue.ToString().Trim('"'); // remove quotes + var fullName = sourceContextValue.ToString().Trim('"'); var shortName = fullName.Split('.').Last(); var shortContext = propertyFactory.CreateProperty("ShortSourceContext", shortName); logEvent.AddPropertyIfAbsent(shortContext); diff --git a/src/Nocr.TelegramListener.Host/appsettings.json b/src/Nocr.TelegramListener.Host/appsettings.json index 36638cd..b981ddd 100644 --- a/src/Nocr.TelegramListener.Host/appsettings.json +++ b/src/Nocr.TelegramListener.Host/appsettings.json @@ -12,7 +12,7 @@ { "Name": "Console", "Args": { - "outputTemplate": "[{Level:u3}] {Timestamp:MM-dd HH:mm:ss} [#{ThreadId}] {ShortSourceContext:l} {Message:lj}{NewLine}{Exception}" + "outputTemplate": "[{Level:u3}] {Timestamp:MM-dd HH:mm:ss} [#{ThreadId}] {ShortSourceContext:l}: {Message:lj}{NewLine}{Exception}" } } ]