From 8ecfdf4577b94530a13049dc6588f988064635f1 Mon Sep 17 00:00:00 2001 From: xljiulang <366193849@qq.com> Date: Thu, 29 Jul 2021 22:50:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=A2=E6=88=B7=E7=AB=AFip=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FastGithub.ReverseProxy/RequestLoggingMilldeware.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/FastGithub.ReverseProxy/RequestLoggingMilldeware.cs b/FastGithub.ReverseProxy/RequestLoggingMilldeware.cs index 95cf4c1..afe4064 100644 --- a/FastGithub.ReverseProxy/RequestLoggingMilldeware.cs +++ b/FastGithub.ReverseProxy/RequestLoggingMilldeware.cs @@ -2,6 +2,7 @@ using Microsoft.Extensions.Logging; using System; using System.Diagnostics; +using System.Net; using System.Threading.Tasks; namespace FastGithub.ReverseProxy @@ -46,6 +47,12 @@ namespace FastGithub.ReverseProxy var response = context.Response; var message = $"{request.Method} {request.Scheme}://{request.Host}{request.Path} responded {response.StatusCode} in {stopwatch.Elapsed.TotalMilliseconds} ms"; + var client = context.Connection.RemoteIpAddress; + if (IPAddress.Loopback.Equals(client) == false) + { + message = $"{client} {message}"; + } + var exception = context.GetForwarderErrorFeature()?.Exception; if (exception == null) {