Skip to content

Upgrade Debug-level error logging to Error in buildTripReferences #693

@aaronbrethorst

Description

@aaronbrethorst

Context

In internal/restapi/trips_for_route_handler.go, the buildTripReferences function uses api.Logger.Debug(...) for database query failures at two locations:

  • Line ~365: GetTripsByIDs failure
  • Line ~395: GetRoutesByIDs failure
fetchedTrips, err := api.GtfsManager.GtfsDB.Queries.GetTripsByIDs(ctx, tripIDsToFetch)
if err != nil {
    api.Logger.Debug("failed to fetch trips for references", "error", err)
}

Problem

Debug-level logging is effectively silent in production, where the log level is typically Info or higher. If these batch queries fail (due to database timeout, connection issues, etc.), trip and route references will silently disappear from API responses with no indication in production logs.

Proposed Fix

Upgrade both api.Logger.Debug(...) calls to logging.LogError(...) to ensure these failures are visible in production logs.

Related

Identified during review of #667, which addressed similar silent failures in the block-processing loop of the same handler.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions