Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: feat: add a custom server for logging ON-3130 #986

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

evanp
Copy link
Contributor

@evanp evanp commented Dec 12, 2024

The only way I could find to get logging of all our HTTP requests was to create a custom server that loads NextJS itself.

https://nextjs.org/docs/pages/building-your-application/configuring/custom-server

I don't think this is the path we want to take; it means we lose a lot of NextJS features.

The next best solution I've seen is patching the NextJS library and adding your logging code directly to it! Which is definitely a lot worse.

If someone else gets a good idea of how to do detailed server-side logging on the app, please let me know. Right now I'm stumped.

Description by Korbit AI

What change is being made?

Add a custom server for logging HTTP requests using pino-http in the server.ts file and update dependencies accordingly in package.json and package-lock.json.

Why are these changes being made?

These changes introduce structured logging to our server for better monitoring and debugging capabilities, using pino-http for efficient HTTP request logs. This enhancement aligns with ON-3130 user story requirements, ensuring that any errors and significant events can be logged at appropriate levels for improved observability.

Is this description stale? Ask me to generate a new description by commenting /korbit-generate-pr-description

Signed-off-by: Evan Prodromou <evan@openearth.org>
Copy link

@korbit-ai korbit-ai bot left a comment

Choose a reason for hiding this comment

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

Review Summary by Korbit AI

Code Health Comments

  • Add detailed status messages to console.log and log expected errors for better application observability.
Files scanned
File Path Reviewed
app/server.ts

Explore our documentation to understand the languages and file types we support and the files we ignore.

Need a new review? Comment /korbit-review on this PR and I'll review your latest changes.

Korbit Guide: Usage and Customization

Interacting with Korbit

  • You can manually ask Korbit to review your PR using the /korbit-review command in a comment at the root of your PR.
  • You can ask Korbit to generate a new PR description using the /korbit-generate-pr-description command in any comment on your PR.
  • Too many Korbit comments? I can resolve all my comment threads if you use the /korbit-resolve command in any comment on your PR.
  • Chat with Korbit on issues we post by tagging @korbit-ai in your reply.
  • Help train Korbit to improve your reviews by giving a 👍 or 👎 on the comments Korbit posts.

Customizing Korbit

  • Check out our docs on how you can make Korbit work best for you and your team.
  • Customize Korbit for your organization through the Korbit Console.

Current Korbit Configuration

General Settings
Setting Value
Review Schedule Automatic excluding drafts
Max Issue Count 10
Automatic PR Descriptions
Issue Categories
Category Enabled
Naming
Database Operations
Documentation
Logging
Error Handling
Systems and Environment
Objects and Data Structures
Readability and Maintainability
Asynchronous Processing
Design Patterns
Third-Party Libraries
Performance
Security
Functionality

Feedback and Support

Comment on lines +37 to +41
console.log(
`> Server listening at http://localhost:${port} as ${
dev ? "development" : process.env.NODE_ENV
}`,
);
Copy link

Choose a reason for hiding this comment

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

category Logging

Enhance logging messages for better clarity.

Tell me more

It's great that you've set up a structured logging system using pino-http. However, the logging message in the console.log statement could be more informative. Try to provide more details about your application's status. Also consider adding dedicated logging for expected errors.

Chat with Korbit by mentioning @korbit-ai, and give a 👍 or 👎 to help Korbit improve your reviews.

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

Successfully merging this pull request may close these issues.

1 participant