Skip to content

Commit

Permalink
enriches and compact json formatter for serilog
Browse files Browse the repository at this point in the history
  • Loading branch information
runeanielsen committed Sep 8, 2020
1 parent 679ed8d commit fcdaa54
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 1 addition & 2 deletions scripts/set-environment-minikube.fish
Original file line number Diff line number Diff line change
Expand Up @@ -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"
3 changes: 3 additions & 0 deletions src/OpenFTTH.GDBIntegrator/Internal/HostConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Serialization;
using Serilog;
using Serilog.Formatting.Compact;

namespace OpenFTTH.GDBIntegrator.Internal
{
Expand Down Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/OpenFTTH.GDBIntegrator/OpenFTTH.GDBIntegrator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<PackageReference Include="Serilog.Settings.Configuration" Version="3.1.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
<PackageReference Include="Serilog.Sinks.Debug" Version="1.0.1" />
<PackageReference Include="Serilog.Formatting.Compact" Version="1.1.0" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit fcdaa54

Please sign in to comment.