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
nextIDispatcherThe next dispatcher in the dispatch pipeline.
loggerILoggerThe 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
requestIncomingRequestThe incoming request being dispatched.
cancellationTokenCancellationTokenA cancellation token that receives the cancellation requests.
Returns
- ValueTask<OutgoingResponse>
The outgoing response.