mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-04-22 06:22:50 +08:00
Add LogTrace to IOcelotLogger
Previously only LogDebug and LogError were implemented, however this could/will lead to very noisy logging. Implementing trace should allow a better seperation when debugging.
This commit is contained in:
parent
a007887461
commit
c01f778bf9
@ -29,6 +29,7 @@ namespace Ocelot.Logging
|
|||||||
|
|
||||||
public interface IOcelotLogger
|
public interface IOcelotLogger
|
||||||
{
|
{
|
||||||
|
void LogTrace(string message, params object[] args);
|
||||||
void LogDebug(string message, params object[] args);
|
void LogDebug(string message, params object[] args);
|
||||||
void LogError(string message, Exception exception);
|
void LogError(string message, Exception exception);
|
||||||
}
|
}
|
||||||
@ -44,6 +45,11 @@ namespace Ocelot.Logging
|
|||||||
_scopedDataRepository = scopedDataRepository;
|
_scopedDataRepository = scopedDataRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void LogTrace(string message, params object[] args)
|
||||||
|
{
|
||||||
|
_logger.LogTrace(GetMessageWithOcelotRequestId(message), args);
|
||||||
|
}
|
||||||
|
|
||||||
public void LogDebug(string message, params object[] args)
|
public void LogDebug(string message, params object[] args)
|
||||||
{
|
{
|
||||||
_logger.LogDebug(GetMessageWithOcelotRequestId(message), args);
|
_logger.LogDebug(GetMessageWithOcelotRequestId(message), args);
|
||||||
|
@ -34,7 +34,7 @@ namespace Ocelot.Responder.Middleware
|
|||||||
|
|
||||||
public async Task Invoke(HttpContext context)
|
public async Task Invoke(HttpContext context)
|
||||||
{
|
{
|
||||||
_logger.LogDebug($"entered {MiddlwareName}");
|
_logger.LogTrace($"entered {MiddlwareName}");
|
||||||
_logger.LogDebug($"invoking next middleware from {MiddlwareName}");
|
_logger.LogDebug($"invoking next middleware from {MiddlwareName}");
|
||||||
|
|
||||||
await _next.Invoke(context);
|
await _next.Invoke(context);
|
||||||
@ -53,7 +53,7 @@ namespace Ocelot.Responder.Middleware
|
|||||||
_logger.LogDebug("no pipeline errors, setting and returning completed response");
|
_logger.LogDebug("no pipeline errors, setting and returning completed response");
|
||||||
await _responder.SetResponseOnHttpContext(context, HttpResponseMessage);
|
await _responder.SetResponseOnHttpContext(context, HttpResponseMessage);
|
||||||
}
|
}
|
||||||
_logger.LogDebug($"completed {MiddlwareName}");
|
_logger.LogTrace($"completed {MiddlwareName}");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetErrorResponse(HttpContext context, List<Error> errors)
|
private void SetErrorResponse(HttpContext context, List<Error> errors)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user