From c64b7180108626ac0a393abdb6ff18da50c077a9 Mon Sep 17 00:00:00 2001 From: "Kraemer, Benjamin" Date: Mon, 23 Nov 2020 15:29:12 +0100 Subject: [PATCH] Fixed example --- src/Serilog.Sinks.Loki.Example/Program.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Serilog.Sinks.Loki.Example/Program.cs b/src/Serilog.Sinks.Loki.Example/Program.cs index cae6f82..f3ffc00 100644 --- a/src/Serilog.Sinks.Loki.Example/Program.cs +++ b/src/Serilog.Sinks.Loki.Example/Program.cs @@ -13,7 +13,7 @@ static void Main(string[] args) Logger log = new LoggerConfiguration() .MinimumLevel.Verbose() .Enrich.FromLogContext() - .Enrich.WithProperty("MyPropertyName","MyPropertyValue") + .Enrich.WithProperty("MyLabelPropertyName","MyPropertyValue") .Enrich.WithThreadId() .WriteTo.Console() .WriteTo.LokiHttp(credentials, new LogLabelProvider(), new LokiExampleHttpClient()) @@ -46,6 +46,12 @@ static void Main(string[] args) log.Fatal("Fatal with Property A"); } + using (LogContext.PushProperty("MyAppendPropertyName", 1)) + { + log.Warning("Warning with Property MyAppendPropertyName"); + log.Fatal("Fatal with Property MyAppendPropertyName"); + } + log.Dispose(); } }