Skip to content

feat(server): log rate-limited IPs at warn level#7

Merged
nethoundsh merged 1 commit into
mainfrom
feat/rate-limiter-logging
May 14, 2026
Merged

feat(server): log rate-limited IPs at warn level#7
nethoundsh merged 1 commit into
mainfrom
feat/rate-limiter-logging

Conversation

@nethoundsh
Copy link
Copy Markdown
Owner

Summary

  • rateLimitMiddleware now accepts a *slog.Logger and emits a Warn line with the client IP on every rejected request, making rate-limit events visible without enabling debug logging

Changes

  • cmd/server/main.go: add log *slog.Logger parameter to rateLimitMiddleware; log "rate limit exceeded" with "ip" field; update call site
  • cmd/server/server_test.go: pass silentLog() to rateLimitMiddleware in TestRateLimitMiddleware

Test plan

  • go test ./cmd/server/... passes
  • Rate-limited requests produce a warn-level log line containing the client IP

🤖 Generated with Claude Code

Pass the logger into rateLimitMiddleware and emit a Warn line with the
client IP whenever a request is rejected, making rate-limit events
visible without requiring debug logging.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@nethoundsh nethoundsh merged commit 7e1727f into main May 14, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant