From fcdaa54b9d3959700d69c36c82a2d4eb9932487b Mon Sep 17 00:00:00 2001 From: Rune Nielsen Date: Tue, 8 Sep 2020 21:46:57 +0200 Subject: [PATCH] enriches and compact json formatter for serilog --- scripts/set-environment-minikube.fish | 3 +-- src/OpenFTTH.GDBIntegrator/Internal/HostConfig.cs | 3 +++ src/OpenFTTH.GDBIntegrator/OpenFTTH.GDBIntegrator.csproj | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/set-environment-minikube.fish b/scripts/set-environment-minikube.fish index c4e4bf4..b133da4 100755 --- a/scripts/set-environment-minikube.fish +++ b/scripts/set-environment-minikube.fish @@ -22,5 +22,4 @@ export KAFKA__EVENTROUTENETWORKTOPICNAME="event.route-network" export KAFKA__EVENTGEOGRAPHICALAREAUPDATED="event.geographical-area-updated" # Logging -export SERILOG__MINIMUMLEVEL__DEFAULT="Information" -export SERILOG__WRITETO__NAME="Console" +export SERILOG__MINIMUMLEVEL="Information" diff --git a/src/OpenFTTH.GDBIntegrator/Internal/HostConfig.cs b/src/OpenFTTH.GDBIntegrator/Internal/HostConfig.cs index 35a5b5b..45ab2f2 100644 --- a/src/OpenFTTH.GDBIntegrator/Internal/HostConfig.cs +++ b/src/OpenFTTH.GDBIntegrator/Internal/HostConfig.cs @@ -21,6 +21,7 @@ using Newtonsoft.Json.Converters; using Newtonsoft.Json.Serialization; using Serilog; +using Serilog.Formatting.Compact; namespace OpenFTTH.GDBIntegrator.Internal { @@ -105,6 +106,8 @@ private static void ConfigureLogging(IHostBuilder hostBuilder) { var logger = new LoggerConfiguration() .ReadFrom.Configuration(loggingConfiguration) + .Enrich.FromLogContext() + .WriteTo.Console(new CompactJsonFormatter()) .CreateLogger(); loggingBuilder.AddSerilog(logger, true); diff --git a/src/OpenFTTH.GDBIntegrator/OpenFTTH.GDBIntegrator.csproj b/src/OpenFTTH.GDBIntegrator/OpenFTTH.GDBIntegrator.csproj index 96dbb2e..817ef44 100644 --- a/src/OpenFTTH.GDBIntegrator/OpenFTTH.GDBIntegrator.csproj +++ b/src/OpenFTTH.GDBIntegrator/OpenFTTH.GDBIntegrator.csproj @@ -24,6 +24,7 @@ +