fix: remove request to /health from log
This commit is contained in:
parent
4fc28378c5
commit
ebec0a2d2b
@ -59,11 +59,17 @@ public static class LoggerConfiguration
|
||||
{
|
||||
options.MessageTemplate = "[{RequestMethod}] {RequestPath} [Client {RemoteIPAddress}] [{StatusCode}] in {Elapsed:0.0000} ms";
|
||||
|
||||
options.GetLevel = (_, elapsed, ex) => elapsed >= 2500 || ex != null
|
||||
options.GetLevel = (httpContext, elapsed, ex) =>
|
||||
{
|
||||
if (httpContext.Request.Path.StartsWithSegments("/health"))
|
||||
return LogEventLevel.Verbose;
|
||||
|
||||
return elapsed >= 2500 || ex != null
|
||||
? LogEventLevel.Warning
|
||||
: elapsed >= 1000
|
||||
? LogEventLevel.Information
|
||||
: LogEventLevel.Debug;
|
||||
};
|
||||
|
||||
options.EnrichDiagnosticContext = (diagnosticContext, httpContext) =>
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user