public static void Log(this ILogger logger, RequestProcessingEntity request) { if (logger.GetType() == typeof(Logger <Logger.RequestLogger>)) { logger.Log(LogLevel.Information, new EventId(), request, null, (x, y) => ""); } else { logger.LogInformation("Method: {0} Path: {1} Status code: {2}", request.Method, request.Path, request.StatusCode); } }
protected void LogProcessingInfo(RequestProcessingEntity requestProcessing) { if (requestProcessing != null) { NLog.LogEventInfo theEvent = new NLog.LogEventInfo(NLog.LogLevel.Info, "", ""); theEvent.Properties["HTTPMethod"] = requestProcessing.Method; theEvent.Properties["Path"] = requestProcessing.Path; theEvent.Properties["StatusCode"] = requestProcessing.StatusCode; _logger.Info(theEvent); } }