serilog / serilog-aspnetcore

Serilog integration for ASP.NET Core
Apache License 2.0
1.32k stars 209 forks source link

LogContext.PushProperty for all log calls in a project #321

Closed gitzko closed 1 year ago

gitzko commented 1 year ago

Is your feature request related to a problem? Please describe. I need to have a property appended to each allready present log call in a project.

Describe the solution you'd like "inject" a LogContext.Push Property to each ILogger log call already present in my project.

Describe alternatives you've considered I tried creating an ILoggerProvider wrapper which would receieve a SerilogProvider through constructor, but I couldn't make it with Serilog for Asp.net core.

Additional context Add any other context or screenshots about the feature request here.

nblumhardt commented 1 year ago

Enrichers (Enrich.With..) on your LoggerConfiguration are the answer to this. If you need further details this might be one best for Stack Overflow. Hope this helps!