public void OnException(ExceptionContext context) { HttpStatusCode actualResultCode; if (ErrorToResponseMap.GetFromActionProperties(context.ActionDescriptor.Properties, out var map) && map.TryGetBinding(context.Exception.GetType(), out var binding)) { actualResultCode = SetBoundResult(context, binding); } else { actualResultCode = SetErrorResult(context); } if ((int)actualResultCode >= 500) { _log.Error(context.Exception) .AndFactIs("response-code", actualResultCode) .AndFactIs(HttpTraceIdFact.Key, context.HttpContext.TraceIdentifier) .Write(); } else if ((int)actualResultCode >= 400) { _log.Warning(context.Exception) .AndFactIs("response-code", actualResultCode) .AndFactIs(HttpTraceIdFact.Key, context.HttpContext.TraceIdentifier) .Write(); } }
/// <summary> /// Begin DSL expression for warning log-event /// </summary> public static DslExpression Warning(this IDslLogger dslLogger, string message, Exception reasonException) { if (dslLogger == null) { throw new ArgumentNullException(nameof(dslLogger)); } return(dslLogger.Warning(message).BecauseOf(reasonException)); }
public DslExpression Warning(string message) { return(ApplyExtensions(_dsl.Warning(message))); }