Example #1
0
        public override void OnActionExecuted(HttpActionExecutedContext actionExecutedContext)
        {
            base.OnActionExecuted(actionExecutedContext);

            _logger.Debug(() => "ACTION ARGUMENTS:\r\n" + string.Join("\r\n", actionExecutedContext.ActionContext.ActionArguments.Select(aa => $"key:{aa.Key}\r\n\tvalue:{aa.Value}")));
            var e = actionExecutedContext.Exception;

            if (e != null /*&& !e.IsLogged()*/)
            {
                _logger.Error(e, "HttpActionExecutedContext.Exception");
                e.MarkAsLogged();
            }
            else if ((int)actionExecutedContext.Response.StatusCode >= 500)
            {
                e = new HttpException(
                    (int)actionExecutedContext.Response.StatusCode,
                    ResolveMessage(actionExecutedContext));
                _logger.Error(e, "Internal Server Error Returned");
                e.MarkAsLogged();
            }
        }