···66import (
77 "encoding/json"
88 "fmt"
99+ "log/slog"
910 "net/http"
1011)
1112···2526 if err := json.NewEncoder(w).Encode(v); err != nil {
2627 // If encoding fails, we can't do much since headers are already sent
2728 // Log the error but don't try to send another response
2828- fmt.Printf("ERROR: failed to encode JSON response: %v\n", err)
2929+ slog.Error("Failed to encode JSON response", "error", err)
2930 }
3031}
3132