コード例 #1
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);

            if (_useOldLog)
            {
                _log.WriteError(
                    exception: ex,
                    context: new
                {
                    url,
                    body
                },
                    process: urlWithoutQuery);
            }
            else
            {
                _log.Error(
                    ex,
                    context: new
                {
                    url,
                    body
                },
                    process: urlWithoutQuery);
            }
        }
コード例 #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);
        }
コード例 #3
0
        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");
        }