diff options
Diffstat (limited to 'app/ratelimit.go')
-rw-r--r-- | app/ratelimit.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/app/ratelimit.go b/app/ratelimit.go index 13508f36f..77d15caa2 100644 --- a/app/ratelimit.go +++ b/app/ratelimit.go @@ -4,12 +4,13 @@ package app import ( + "fmt" "math" "net/http" "strconv" "strings" - l4g "github.com/alecthomas/log4go" + "github.com/mattermost/mattermost-server/mlog" "github.com/mattermost/mattermost-server/model" "github.com/mattermost/mattermost-server/utils" "github.com/pkg/errors" @@ -74,14 +75,14 @@ func (rl *RateLimiter) GenerateKey(r *http.Request) string { func (rl *RateLimiter) RateLimitWriter(key string, w http.ResponseWriter) bool { limited, context, err := rl.throttledRateLimiter.RateLimit(key, 1) if err != nil { - l4g.Critical("Internal server error when rate limiting. Rate Limiting broken. Error:" + err.Error()) + mlog.Critical("Internal server error when rate limiting. Rate Limiting broken. Error:" + err.Error()) return false } setRateLimitHeaders(w, context) if limited { - l4g.Error("Denied due to throttling settings code=429 key=%v", key) + mlog.Error(fmt.Sprintf("Denied due to throttling settings code=429 key=%v", key)) http.Error(w, "limit exceeded", 429) } |