Logging Middleware#75
Merged
Merged
Conversation
ⓘ You are approaching your monthly quota for Qodo. Upgrade your plan Review Summary by QodoImplement HTTP logging middleware for observability
WalkthroughsDescription• Implemented logging middleware for all HTTP requests • Captures method, URI, status code, response time, size • Classifies responses by status (success, redirect, client/server error) • Removed redundant logging from health check handler Diagramflowchart LR
Request["HTTP Request"] -- "LoggingMiddleware" --> Handler["Handler"]
Handler -- "Response" --> LoggingResponseWriter["LoggingResponseWriter<br/>Captures: status, bytes"]
LoggingResponseWriter -- "Logs: method, URI,<br/>status, duration, size, class" --> Logger["Logger"]
File Changes1. internal/http/middleware/logging.go
|
Code Review by Qodo
1.
|
AarshShah9
approved these changes
Mar 29, 2026
NickSavino
added a commit
that referenced
this pull request
Mar 29, 2026
* Small changes to dev tooling (docker/make/compose * Server: minor variable rename * Auth middleware + clerk webhook handler * Added WithTransaction to store * Removed debug logging message exposing userid * Removed docker-compose changes not relevant to PR * Renamed users.go to users.handler.go in handlers * Added documentation explaining dev bypass * Feat/calibration-endpoints (#57) * added user calibration endpoints and schema" - Added user_calibration migration - Added sqlc queries for calibration CRUD operations - added /api/users/me/calibration endpoints: GET, POST, DELETE - me endpoint now fetches user from clerk id using middleware, enhancing security - removed GET methods for user (GET /{id}, GET /) * Fixed line endings * Fixed time formatting in handler * Added NOT NULL constrain to updated_at, created_at in db table switch go dev container port to correct mapping (8080) fixed variable typo in middleware_auth.go --------- Co-authored-by: NicolaSavino <nick.savino@arcurve.com> * Fixed syntax error on migration (#58) Co-authored-by: NicolaSavino <nick.savino@arcurve.com> * Feat/workouts api (#59) * Implemented workout and calibration schema with included sqlc queries. Updated makefile and seeding files * Regenerated SQLC to match new queries and models (workout type + workout session) * Added workout session service * Added Workout Handler Endpoint * Addressed PR comments - fixed syntax error in makefile - Fixed migration schema - fixed seeding script - added /service/helps/helpers.util file - renamed Dtos to match go standards, (Id -> ID) * Updated API endpoints * updated dtos to match casing convention. updated workout_session logic * Added functionality for workout sets and reps. (services, handlers, migrations, queries) * Addressed PR comments * Addressed PR comments --------- Co-authored-by: NicolaSavino <nick.savino@arcurve.com> * fix: added clerk webhook secret (#62) * Fix/add clerkwebhook secret (#64) * fix: added clerk webhook secret * updated CRLF line endings to LF * Fix/add clerkwebhook secret (#66) * fix: added clerk webhook secret * updated CRLF line endings to LF * fix * prod fix * Seed Script: Wipe Data (#69) * Prod fix (#67) * Small changes to dev tooling (docker/make/compose * Server: minor variable rename * Auth middleware + clerk webhook handler * Added WithTransaction to store * Removed debug logging message exposing userid * Removed docker-compose changes not relevant to PR * Renamed users.go to users.handler.go in handlers * Added documentation explaining dev bypass * Feat/calibration-endpoints (#57) * added user calibration endpoints and schema" - Added user_calibration migration - Added sqlc queries for calibration CRUD operations - added /api/users/me/calibration endpoints: GET, POST, DELETE - me endpoint now fetches user from clerk id using middleware, enhancing security - removed GET methods for user (GET /{id}, GET /) * Fixed line endings * Fixed time formatting in handler * Added NOT NULL constrain to updated_at, created_at in db table switch go dev container port to correct mapping (8080) fixed variable typo in middleware_auth.go --------- Co-authored-by: NicolaSavino <nick.savino@arcurve.com> * Fixed syntax error on migration (#58) Co-authored-by: NicolaSavino <nick.savino@arcurve.com> * Feat/workouts api (#59) * Implemented workout and calibration schema with included sqlc queries. Updated makefile and seeding files * Regenerated SQLC to match new queries and models (workout type + workout session) * Added workout session service * Added Workout Handler Endpoint * Addressed PR comments - fixed syntax error in makefile - Fixed migration schema - fixed seeding script - added /service/helps/helpers.util file - renamed Dtos to match go standards, (Id -> ID) * Updated API endpoints * updated dtos to match casing convention. updated workout_session logic * Added functionality for workout sets and reps. (services, handlers, migrations, queries) * Addressed PR comments * Addressed PR comments --------- Co-authored-by: NicolaSavino <nick.savino@arcurve.com> * fix: added clerk webhook secret (#62) * Fix/add clerkwebhook secret (#64) * fix: added clerk webhook secret * updated CRLF line endings to LF * Fix/add clerkwebhook secret (#66) * fix: added clerk webhook secret * updated CRLF line endings to LF * fix --------- Co-authored-by: NicolaSavino <nick.savino@arcurve.com> * fix: wipe data on seed --------- Co-authored-by: Nicola Savino <77707655+NickSavino@users.noreply.github.com> Co-authored-by: NicolaSavino <nick.savino@arcurve.com> * fix: (#70) - updated workout session history endpoint - added reset_workflow script along with github action - added ingestion functionality for webhook * Feat: Setup Cloudwatch Logs for EC2 (#73) * feat: setup AWS Cloudwatch resource and updated deploy script to attach to logging * Increaed EC2 Tier and added elastic ip (#76) * Increaed EC2 Tier and added elastic ip * added newline to EOF * Logging Middleware (#75) * Added Logging Middleware to increase observability * small rename * Refactored user handler logic to be executed in service * Updated logging.go to adress bot comments * Updated logging middleware to forward optional http.ResponseWriter interfaces --------- Co-authored-by: NicolaSavino <nick.savino@arcurve.com> Co-authored-by: Aarsh Shah <86862845+AarshShah9@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
logging.go has been created and injected as middleware, for each request, the following data is logged:
This will increase our observability and make debugging in production easier