Created
September 7, 2017 01:48
-
-
Save dcomartin/e4953732c09ef388ef3118fd96e79c2f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class RequestLogger<TRequest> : IRequestPreProcessor<TRequest> | |
{ | |
private readonly ILoggerFactory _loggerFactory; | |
public RequestLogger(ILoggerFactory loggerFactory) | |
{ | |
_loggerFactory = loggerFactory; | |
} | |
public Task Process(TRequest request) | |
{ | |
var logger = _loggerFactory.CreateLogger<TRequest>(); | |
// Do some logging to record the Request | |
logger.LogInformation(DateTime.UtcNow.ToString("yyyy-MM-dd hh:mm:ss.fff")); | |
return Task.CompletedTask; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment