• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

map-services / street-manager-relay / 26061490487

18 May 2026 09:27PM UTC coverage: 4.221% (+2.9%) from 1.35%
26061490487

push

github

web-flow
fix: convert to JSON structured logging using `log/slog` (#45)

_This is an automated PR generated by Gemini in response to issue #44._

## Summary

The codebase has been successfully converted to use structured JSON
logging with `log/slog`.

### Key Changes
1. **Centralized Logger Setup**: Created `internal/logger.go` with
`SetupLogger()` to initialize `slog.JSONHandler` and set it as the
default logger.
2. **Request Middleware**: Created `internal/middleware/logger.go` to
provide a Gin-compatible middleware for structured HTTP request logging.
3. **Application Integration**: Updated `cmd/api_server.go` to
initialize the logger and use the new middleware for request logging,
replacing the old `gin.LoggerWithWriter`.
4. **Standard Logging Replacement**: Updated all usages of `log.Printf`,
`log.Fatalf`, and `log.Println` in `cmd/bulk_loader.go`,
`cmd/regen_rtree.go`, `cmd/update_favicons.go` to use `slog` methods
(`slog.Info`, `slog.Error`, `slog.Warn`), ensuring proper field-based
structured logging.
5. **Testing**: Added `internal/logger_test_utils.go` and
`internal/middleware/logger_test.go` to provide a helper for capturing
JSON output and a test case to verify that the request logger middleware
produces correct JSON logs.

All tests are passing, and the application builds successfully.

> [!CAUTION]
> Please review the generated code carefully before merging!

Closes #44

---------

Co-authored-by: gemini-pr-agent[bot] <285455830+gemini-pr-agent[bot]@users.noreply.github.com>
Co-authored-by: Richard Hull <rm_hull@yahoo.co.uk>

22 of 78 new or added lines in 12 files covered. (28.21%)

5 existing lines in 2 files now uncovered.

61 of 1445 relevant lines covered (4.22%)

0.05 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/cmd/api_server.go


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc