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.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
|
? LogEventLevel.Warning
|
||||||
: elapsed >= 1000
|
: elapsed >= 1000
|
||||||
? LogEventLevel.Information
|
? LogEventLevel.Information
|
||||||
: LogEventLevel.Debug;
|
: LogEventLevel.Debug;
|
||||||
|
};
|
||||||
|
|
||||||
options.EnrichDiagnosticContext = (diagnosticContext, httpContext) =>
|
options.EnrichDiagnosticContext = (diagnosticContext, httpContext) =>
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user