I have a logging use case where I want to log a specific API call at a different level than all of the other API services using Serilog, Log.Logger. My current logger configuration for the application is something like:
Log.Logger = new LoggerConfiguration()
.MinimumLevel.ControlledBy(_loggingLevelSwitch)
.WriteTo.MSSqlServer(connectionString, "LogTable")
.CreateLogger();
So, when I call SetLoggingLevelSwitch to update the log level, it updates the level for the entire application, which is expected. What I'm wondering is, in an individual API call, can I override the log level just for the scope of that API call and not affect the log level in the rest of the application?
Thanks!