Class LoggerMiddleware
A middleware that writes a log entry to an ILogger for each dispatch.
public class LoggerMiddleware : IDispatcher
- Inheritance
-
LoggerMiddleware
- Implements
- Inherited Members
Constructors
LoggerMiddleware(IDispatcher, ILogger)
Constructs a logger middleware.
public LoggerMiddleware(IDispatcher next, ILogger logger)
Parameters
next
IDispatcherThe next dispatcher in the dispatch pipeline.
logger
ILoggerThe logger to log to.
Methods
DispatchAsync(IncomingRequest, CancellationToken)
Dispatches an incoming request and returns the corresponding outgoing response.
public ValueTask<OutgoingResponse> DispatchAsync(IncomingRequest request, CancellationToken cancellationToken)
Parameters
request
IncomingRequestThe incoming request being dispatched.
cancellationToken
CancellationTokenA cancellation token that receives the cancellation requests.
Returns
- ValueTask<OutgoingResponse>
The corresponding OutgoingResponse.