In Part 9 , I Dockerized my backend and added database migrations. One command ( docker compose up ) now spins up Go + Postgres + Redis.
Then I hit a bug. I sent a POST to /entries and got a 500 back. No idea why.
I opened the logs:
2026/02/01 10:15:23 POST /entries - Request received 2026/02/01 10:15:23 Creating entry for user ID: 3 2026/02/01 10:15:23 POST /entries - Request received 2026/02/01 10:15:23 Creating entry for user ID: 7 2026/02/01 10:15:23 Failed to extract user_id from context 2026/02/01 10:15:23 Entry created successfully with ID: 42
Enter fullscreen mode
Exit fullscreen mode
Five lines. Three users. Which line belongs to which request? I had no idea. The logs were flat strings β timestamps and messages, nothing else. When two requests hit at the same millisecond, the lines interleaved and became useless.
I couldn't debug my own backend.
Step 1: Replace Every log.Printf in the Codebase
Go ships a structured logging package in the standard library: log/slog .β¦