Skip to content

refactor: centralize HTTP logging middleware in shared package#2021

Open
dobrac wants to merge 2 commits intomainfrom
dobrac/api-http-logging
Open

refactor: centralize HTTP logging middleware in shared package#2021
dobrac wants to merge 2 commits intomainfrom
dobrac/api-http-logging

Conversation

@dobrac
Copy link
Contributor

@dobrac dobrac commented Feb 27, 2026

Moves LoggingMiddleware and types to packages/shared/pkg/middleware to eliminate duplicate implementations between API and dashboard-api services.

Both services now import from the shared package. The logging registration is simplified using Config.Context for team ID enrichment and Config.Skipper for path exclusion, removing the need for the ExcludeRoutes wrapper in log setup.

The middleware implementation remains unchanged—this is purely a refactor to promote code reuse.


Note

Low Risk
Low risk refactor limited to request logging behavior, but changes to skip-path matching (e.g., FullPath() vs raw URL path) could slightly alter which endpoints get logged and how team context is attached.

Overview
Both services switch to the shared LoggingMiddleware and configure per-request team ID enrichment via Config.Context, while replacing the API’s prior ExcludeRoutes-wrapped logger with the shared middleware’s Skipper/SkipPaths controls for excluding noisy endpoints; the shared logging config is also lightly clarified with a comment tweak around Skipper.

Written by Cursor Bugbot for commit 9f5a315. This will update automatically on new commits. Configure here.

Move LoggingMiddleware and related types to packages/shared/pkg/middleware
to enable reuse across services. Both API and dashboard-api now import from
the shared package instead of maintaining duplicate implementations.

Simplify logging middleware registration in both services using Config.Context
for team ID enrichment and Config.Skipper for path exclusion, eliminating the
need for ExcludeRoutes wrapper in the logging setup.
@dobrac dobrac marked this pull request as ready for review February 27, 2026 23:38
@dobrac dobrac added improvement Improvement for current functionality feature New feature labels Feb 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature improvement Improvement for current functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants