AspNetCoreRateLimit icon indicating copy to clipboard operation
AspNetCoreRateLimit copied to clipboard

Support defining log level of blocked request message via configuration.

Open ymor opened this issue 7 years ago • 3 comments

Although as suggested in the documents you can override the LogBlockedRequest on the IpRateLimitMiddleware. It would be nice to be able to specify the log level of this message via configuration.

ymor avatar Jan 23 '18 13:01 ymor

@ymor can I get a sample on how to override the LogBlockedRequest? Overriding IpRateLimitMiddleware.LogBlockedRequest will have us override it's constructor too , getting values for which is difficult.

manisha201301 avatar Jul 28 '21 14:07 manisha201301

Hi, @manisha201301 I don't have an example handy but the values for the constructor should be populated by the DependencyInjection framework assuming you have registered them with one of the AddInMemoryRateLimiting or AddDistributedRateLimiting methods in your startup. See https://github.com/stefanprodan/AspNetCoreRateLimit/blob/d95385e534656dc8bad276637e51cb2e9bc40f44/src/AspNetCoreRateLimit/StartupExtensions.cs

ymor avatar Jul 28 '21 14:07 ymor

Thanks, also this solved my problem: https://github.com/stefanprodan/AspNetCoreRateLimit/issues/7#issuecomment-261670002

manisha201301 avatar Jul 28 '21 15:07 manisha201301