Example #1
0
        /// <summary>
        /// Logs the request.
        /// </summary>
        /// <param name="context">The context.</param>
        private async Task LogRequest(HttpContext context)
        {
            context.Request.EnableBuffering();
            using (var requestStream = _recyclableMemoryStreamManager.GetStream())
            {
                await context.Request.Body.CopyToAsync(requestStream);

                _logger.Info(() => $"Http Request Information:{Environment.NewLine}" +
                             $"Schema:{context.Request.Scheme} " +
                             $"Host: {context.Request.Host} " +
                             $"Path: {context.Request.Path} " +
                             $"QueryString: {context.Request.QueryString} " +
                             $"Request Body: {ReadStreamInChunks(requestStream)}");
            }
            context.Request.Body.Position = 0;
        }
Example #2
0
 public IActionResult GetLabels()
 {
     _logger.Info(() => "Api GetLabel");
     return(StatusCode((int)HttpStatusCode.OK, _labelService.GetLabels()));
 }