Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
Thank you for following the naming conventions! 🙏 |
commit: |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds an opt-in “typed fields” capability to evlog’s request-scoped logging API by introducing a generic parameter on RequestLogger (and consumers like useLogger, createRequestLogger, and createWorkersLogger). The goal is to provide compile-time safety for wide-event fields while preserving existing untyped behavior.
Changes:
- Adds
RequestLogger<T>and threads the generic throughcreateRequestLogger,useLogger, andcreateWorkersLogger. - Introduces
InternalFieldsto allow plugin-managed fields (e.g.,status,service) alongside user-typed fields. - Adds documentation and tests demonstrating typed-field usage.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/evlog/test/logger.test.ts | Adds runtime tests demonstrating typed-field usage patterns. |
| packages/evlog/src/types.ts | Defines InternalFields and makes RequestLogger generic with typed parameters/return types. |
| packages/evlog/src/logger.ts | Updates createRequestLogger to return RequestLogger<T> and adjusts method typings. |
| packages/evlog/src/runtime/server/useLogger.ts | Makes useLogger generic and updates examples. |
| packages/evlog/src/workers/index.ts | Makes createWorkersLogger generic and attempts to enrich context with CF fields. |
| packages/evlog/src/index.ts | Exports InternalFields type. |
| apps/playground/server/api/test/structured-error.get.ts | Updates playground route to use useLogger<T> and adds a large typed field interface. |
| apps/docs/content/2.core-concepts/4.typed-fields.md | New documentation page for typed fields. |
| apps/docs/content/2.core-concepts/1.wide-events.md | Adds a “Typed Fields” link in Next Steps. |
| apps/docs/content/1.getting-started/3.quick-start.md | Adds a “Typed Fields” link in Next Steps. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
This pull request introduces a new "typed fields" feature to the logging system, enabling compile-time type safety for wide event logging. Users can now define interfaces for their log fields, ensuring consistency and preventing typos across their codebase. The change is fully opt-in and maintains backward compatibility for untyped usage. Documentation and tests have been added to support and demonstrate the new functionality.