Skip to content

Centralized request and response logging middleware#39

Open
RajuSinghRaj wants to merge 1 commit intoSpyxpo:stablefrom
RajuSinghRaj:feature/logging-error-handling
Open

Centralized request and response logging middleware#39
RajuSinghRaj wants to merge 1 commit intoSpyxpo:stablefrom
RajuSinghRaj:feature/logging-error-handling

Conversation

@RajuSinghRaj
Copy link
Copy Markdown
Contributor

Description

This pull request enhances backend observability by adding centralized request and response logging using Flask middleware. The changes build on the existing logging setup without duplicating functionality.

Related Issue

Closes #38

Proposed Changes

  • Added request logging using @app.before_request to capture HTTP method and path
  • Added response logging using @app.after_request to capture status codes and execution time
  • Integrated with the existing centralized logging configuration
  • Ensured logging works consistently across all routes without affecting existing behavior

Screenshots or Logs

Sample log entries:

  • Incoming request: GET /
  • Response: GET / -> 200 (0.008s)

Testing

  • Verified logs are generated for incoming requests and outgoing responses
  • Tested multiple routes including static assets and API endpoints
  • Confirmed logs are written without breaking existing functionality

Additional Notes

This change improves backend monitoring and debugging while keeping the implementation minimal and production-safe. No existing logging or error-handling logic was duplicated or removed.

Checklist

  • Code follows the project's coding conventions
  • Logging middleware tested locally
  • No breaking changes introduced
  • Works with existing logging configuration
  • Automated tests (to be added in a future task)

By submitting this pull request, I confirm that my contribution is made under the project's license.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

centralized logging and global error-handling middleware

1 participant