forked from stefanprodan/WebApiThrottle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
71689a7
commit b675555
Showing
4 changed files
with
31 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using System.Web.Http.Tracing; | ||
|
||
namespace WebApiThrottle | ||
{ | ||
public class TracingThrottleLogger : IThrottleLogger | ||
{ | ||
private readonly ITraceWriter traceWriter; | ||
|
||
public TracingThrottleLogger(ITraceWriter traceWriter) | ||
{ | ||
this.traceWriter = traceWriter; | ||
} | ||
|
||
public void Log(ThrottleLogEntry entry) | ||
{ | ||
if (null != traceWriter) | ||
{ | ||
traceWriter.Info(entry.Request, "WebApiThrottle", "{0} Request {1} to endpoint {2} from client {3} has been throttled (blocked), quota {4}/{5} exceeded by {6}", | ||
entry.LogDate, entry.RequestId, entry.ClientIp, entry.RateLimit, | ||
entry.Endpoint, entry.RateLimitPeriod, entry.TotalRequests); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters