private void Log(MeasurementDetails details)
        {
            var method = details.Request.Method.Method;
            var uri = details.Request.RequestUri;

            HttpStatusCode status = 0;
            string result = null;
            if (details.SendTask.IsCompleted)
            {
                var r = details.SendTask.Result;
                status = r.StatusCode;
                result = r.IsSuccessStatusCode ? "completed successfully" : "failed";
            }
            else if (details.SendTask.IsCanceled)
            {
                result = "canceled";
            }
            else if (details.SendTask.IsFaulted)
            {
                result = "faulted";
            }

            //generates log entry like: "HTTP GET at http://localhost/foo.bar failed with status NotFound in 19ms."
            var message = "HTTP {HttpMethod} at {ServiceUri} {HttpResult} with status {HttpStatus} in {ElapsedMilliseconds}ms.";
            logger.LogInformation(message, method, uri, result, status, details.ElapsedMilliseconds);
        }
        private void Log(MeasurementDetails details)
        {
            var method = details.Request.Method.Method;
            var uri    = details.Request.RequestUri;

            HttpStatusCode status = 0;
            string         result = null;

            if (details.SendTask.IsCompleted)
            {
                var r = details.SendTask.Result;
                status = r.StatusCode;
                result = r.IsSuccessStatusCode ? "completed successfully" : "failed";
            }
            else if (details.SendTask.IsCanceled)
            {
                result = "canceled";
            }
            else if (details.SendTask.IsFaulted)
            {
                result = "faulted";
            }

            //generates log entry like: "HTTP GET at http://localhost/foo.bar failed with status NotFound in 19ms."
            var message = "HTTP {HttpMethod} at {ServiceUri} {HttpResult} with status {HttpStatus} in {ElapsedMilliseconds}ms.";

            logger.LogInformation(message, method, uri, result, status, details.ElapsedMilliseconds);
        }