Skip to content

Commit

Permalink
Fixed example
Browse files Browse the repository at this point in the history
  • Loading branch information
Falco20019 committed Nov 23, 2020
1 parent 88fb792 commit c64b718
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Serilog.Sinks.Loki.Example/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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();
}
}
Expand Down

0 comments on commit c64b718

Please sign in to comment.