fixed output template for logging.

This commit is contained in:
Ruberoid 2025-07-22 20:29:46 +03:00
parent 9316f08a73
commit 24e550d612
3 changed files with 3 additions and 3 deletions

View File

@ -13,7 +13,7 @@ public class HostBuilderFactory<TStartup> 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) =>
{

View File

@ -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);

View File

@ -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}"
}
}
]