Skip to content

feat: add opt-in generic T to RequestLogger and useLogger#66

Merged
HugoRCD merged 2 commits intomainfrom
EVL-68
Feb 10, 2026
Merged

feat: add opt-in generic T to RequestLogger and useLogger#66
HugoRCD merged 2 commits intomainfrom
EVL-68

Conversation

@HugoRCD
Copy link
Copy Markdown
Owner

@HugoRCD HugoRCD commented Feb 10, 2026

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.

@HugoRCD HugoRCD self-assigned this Feb 10, 2026
@HugoRCD HugoRCD requested a review from Copilot February 10, 2026 21:43
@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 10, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
evlog-docs Ready Ready Preview, Comment, Open in v0 Feb 10, 2026 10:11pm

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 10, 2026

Thank you for following the naming conventions! 🙏

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Feb 10, 2026

npm i https://pkg.pr.new/evlog@66

commit: 1fb370a

Copy link
Copy Markdown
Contributor

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

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 through createRequestLogger, useLogger, and createWorkersLogger.
  • Introduces InternalFields to 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.

Comment thread packages/evlog/src/types.ts
Comment thread packages/evlog/src/types.ts Outdated
Comment thread packages/evlog/src/workers/index.ts Outdated
Comment thread apps/playground/server/api/test/structured-error.get.ts
Comment thread packages/evlog/src/runtime/server/useLogger.ts
@HugoRCD HugoRCD merged commit 0f400fa into main Feb 10, 2026
11 checks passed
@HugoRCD HugoRCD deleted the EVL-68 branch February 10, 2026 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants