From 4cbf3a4b5b3b8e728bcf0234d3377ba762b9f033 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Fri, 30 Mar 2018 08:40:58 -0400 Subject: [PATCH] format ban logs better --- src/Core/Utilities/CustomIpRateLimitMiddleware.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Core/Utilities/CustomIpRateLimitMiddleware.cs b/src/Core/Utilities/CustomIpRateLimitMiddleware.cs index 7314845dd7..2d176f7d9c 100644 --- a/src/Core/Utilities/CustomIpRateLimitMiddleware.cs +++ b/src/Core/Utilities/CustomIpRateLimitMiddleware.cs @@ -60,11 +60,11 @@ namespace Bit.Core.Utilities if(blockedCount > 10) { _blockIpService.BlockIpAsync(identity.ClientIp, false); - _logger.LogInformation($"Banned {identity.ClientIp}. Info: {GetRequestInfo(httpContext)}"); + _logger.LogInformation($"Banned {identity.ClientIp}. \nInfo: \n{GetRequestInfo(httpContext)}"); } else { - _logger.LogInformation($"Request blocked {identity.ClientIp}. Info: {GetRequestInfo(httpContext)}"); + _logger.LogInformation($"Request blocked {identity.ClientIp}. \nInfo: \n{GetRequestInfo(httpContext)}"); _memoryCache.Set(key, blockedCount, new MemoryCacheEntryOptions().SetSlidingExpiration(new TimeSpan(0, 5, 0))); } @@ -80,12 +80,12 @@ namespace Bit.Core.Utilities var s = string.Empty; foreach(var header in httpContext.Request.Headers) { - s += $"H_{header.Key}: {header.Value} | "; + s += $"Header \"{header.Key}\": {header.Value} \n"; } foreach(var query in httpContext.Request.Query) { - s += $"Q_{query.Key}: {query.Value} | "; + s += $"Query \"{query.Key}\": {query.Value} \n"; } return s;