private async Task LogError(HttpContext context, Exception ex)
        {
            var url             = context.Request?.GetUri()?.AbsoluteUri;
            var urlWithoutQuery = RequestUtils.GetUrlWithoutQuery(url) ?? "?";
            var body            = await RequestUtils.GetRequestPartialBodyAsync(context);

            if (_useOldLog)
            {
                _log.WriteError(
                    exception: ex,
                    context: new
                {
                    url,
                    body
                },
                    process: urlWithoutQuery);
            }
            else
            {
                _log.Error(
                    ex,
                    context: new
                {
                    url,
                    body
                },
                    process: urlWithoutQuery);
            }
        }
Exemplo n.º 2
0
        private async Task LogError(HttpContext context, Exception ex)
        {
            var url             = context.Request?.GetUri()?.AbsoluteUri;
            var urlWithoutQuery = RequestUtils.GetUrlWithoutQuery(url) ?? "?";
            var body            = await RequestUtils.GetRequestPartialBodyAsync(context);

            _log.WriteError(urlWithoutQuery, new
            {
                url  = url,
                body = body
            },
                            ex);
        }
        private async Task LogError(HttpContext context)
        {
            var url             = context.Request?.GetUri()?.AbsoluteUri;
            var urlWithoutQuery = RequestUtils.GetUrlWithoutQuery(url) ?? "?";
            var body            = await RequestUtils.GetRequestPartialBodyAsync(context);

            _log.WriteWarning(urlWithoutQuery, new
            {
                url        = url,
                statusCode = context.Response.StatusCode,
                body       = body
            },
                              "Client request error");
        }