From 2192c3f4c507947521796c3db8a1746f07025f92 Mon Sep 17 00:00:00 2001 From: claude Date: Wed, 17 Jun 2026 11:03:55 +0300 Subject: [PATCH] Logs: Compact JSON + aligned enrichment in shared StartupExtensions CompactJsonFormatter in both ConfigureJsonSerilog overloads; rename Service->Application, EnvironmentName->Environment (keep AppVersion). Applies to all myAi services. Co-Authored-By: Claude Opus 4.8 --- Directory.Packages.props | 1 + Helpers/startup-helpers/StartupExtensions.cs | 14 ++++++-------- Helpers/startup-helpers/startup-helpers.csproj | 1 + 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 7d04f04..817eda5 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -23,6 +23,7 @@ + diff --git a/Helpers/startup-helpers/StartupExtensions.cs b/Helpers/startup-helpers/StartupExtensions.cs index c806e1b..ce55b4d 100644 --- a/Helpers/startup-helpers/StartupExtensions.cs +++ b/Helpers/startup-helpers/StartupExtensions.cs @@ -39,11 +39,10 @@ public static class StartupExtensions .ReadFrom.Configuration(context.Configuration) .ReadFrom.Services(services) .Enrich.FromLogContext() - .Enrich.WithMachineName() - .Enrich.WithEnvironmentName() - .Enrich.WithProperty("Service", serviceName) + .Enrich.WithProperty("Application", serviceName) + .Enrich.WithProperty("Environment", context.HostingEnvironment.EnvironmentName) .Enrich.WithProperty("AppVersion", appVersion) - .WriteTo.Console(new Serilog.Formatting.Json.JsonFormatter()); + .WriteTo.Console(new Serilog.Formatting.Compact.CompactJsonFormatter()); AddEmailSinkIfConfigured(configuration, context.Configuration, serviceName); }); @@ -57,11 +56,10 @@ public static class StartupExtensions .ReadFrom.Configuration(builder.Configuration) .ReadFrom.Services(services) .Enrich.FromLogContext() - .Enrich.WithMachineName() - .Enrich.WithEnvironmentName() - .Enrich.WithProperty("Service", serviceName) + .Enrich.WithProperty("Application", serviceName) + .Enrich.WithProperty("Environment", builder.Environment.EnvironmentName) .Enrich.WithProperty("AppVersion", appVersion) - .WriteTo.Console(new Serilog.Formatting.Json.JsonFormatter()); + .WriteTo.Console(new Serilog.Formatting.Compact.CompactJsonFormatter()); AddEmailSinkIfConfigured(configuration, builder.Configuration, serviceName); }); diff --git a/Helpers/startup-helpers/startup-helpers.csproj b/Helpers/startup-helpers/startup-helpers.csproj index 89d7a7c..0563262 100644 --- a/Helpers/startup-helpers/startup-helpers.csproj +++ b/Helpers/startup-helpers/startup-helpers.csproj @@ -17,6 +17,7 @@ +