Skip to content

feat: log api requests#2889

Draft
cqnykamp wants to merge 11 commits intoDoenet:mainfrom
cqnykamp:feature/logging
Draft

feat: log api requests#2889
cqnykamp wants to merge 11 commits intoDoenet:mainfrom
cqnykamp:feature/logging

Conversation

@cqnykamp
Copy link
Copy Markdown
Contributor

No description provided.

cqnykamp and others added 2 commits April 29, 2026 13:50
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds structured request lifecycle logging to the API server using pino-http, with accompanying unit tests, so /api/* requests emit consistent “start” and “end” log events.

Changes:

  • Add pino-http dependency (and lockfile updates).
  • Introduce initRequestLogger() middleware to emit request_start (debug) and request_end (info) lifecycle logs.
  • Register the middleware for /api routes and add Vitest coverage for the logger behavior.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
package-lock.json Updates lockfile for pino-http and aligns Node engine resolution.
apps/api/package.json Adds pino-http to API dependencies.
apps/api/src/middleware/requestLogger.ts Implements request lifecycle logging middleware with curated metadata fields.
apps/api/src/index.ts Wires request logging middleware into the Express app for /api routes.
apps/api/src/test/requestLogger.test.ts Adds tests verifying emitted start/end logs and safe auth metadata fields.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread apps/api/src/middleware/requestLogger.ts Outdated
Comment thread apps/api/src/middleware/requestLogger.ts Outdated
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.

2 participants