Skip to content

Comments

feat: centralize logging, tighten runtime types, and improve doc#9

Open
Dayifour wants to merge 5 commits intoakinloluwami:mainfrom
Dayifour:dayif-feat
Open

feat: centralize logging, tighten runtime types, and improve doc#9
Dayifour wants to merge 5 commits intoakinloluwami:mainfrom
Dayifour:dayif-feat

Conversation

@Dayifour
Copy link

@Dayifour Dayifour commented Nov 17, 2025

Introduces a centralized logger, strengthens internal runtime types, and updates documentation to improve maintainability and contributor onboarding.

Why

  • A central logger allows unified control of verbosity and format.
  • Stricter types reduce unsafe any usage and surface issues earlier.
  • Updated docs clarify architecture and workflow for contributors.

What changed

Added

  • logger.ts: minimal logger (info, warn, error, debug), controlled via REACT_SERVE_LOG.
  • Learn.md: architecture overview, runtime model, API summary, logging notes, contributor guidance.
  • CONTRIBUTING.md: workflow, PR checklist.
  • CODE_OF_CONDUCT.md: contributor guidelines.

Modified

  • runtime.ts: added RouteContext, replaced several any with safer types, updated middleware return type, replaced console.* with logger.*.
  • backend.tsx: updated example logging to use logger.info.
  • Logging can be controlled via REACT_SERVE_LOG (enabled by default).

Summary by cubic

Centralized logging across the runtime, tightened runtime types to reduce unsafe any usage, and added docs to improve onboarding. Logging is enabled by default and can be toggled with REACT_SERVE_LOG.

  • New Features

    • Minimal logger (info/warn/error/debug) controlled by REACT_SERVE_LOG; errors always log; debug only outside production.
    • Added Learn.md, CONTRIBUTING.md, and CODE_OF_CONDUCT.md. Updated the basic example to use logger-based request logging.
  • Refactors

    • Introduced a typed RouteContext and unknown-based contexts; middleware now supports async with next(): Promise.
    • Replaced console.* with logger.*, tightened runtime element traversal and types, and improved server/method logs (startup, hot reload, 405 Allow).

Written for commit 70b31f9. Summary will update on new commits.

@vercel
Copy link

vercel bot commented Nov 17, 2025

@Dayifour is attempting to deploy a commit to the Akinkunmi Team on Vercel.

A member of the Team first needs to authorize it.

@Dayifour
Copy link
Author

Hi @akinloluwami,

I’ve created this PR to centralize logging, tighten runtime types, and improve documentation. Everything is backward-compatible and logging is enabled by default with the REACT_SERVE_LOG switch.

The main changes are:

Added a minimal logger (info, warn, error, debug).

Strengthened internal types in runtime.ts.

Updated Learn.md, CONTRIBUTING.md, and CODE_OF_CONDUCT.md.

Updated example logging in backend.tsx.

Please review when you have a moment. I’m happy to adjust anything if needed.

Thanks!

@Dayifour
Copy link
Author

Hi @akinloluwami, I hope you're doing well! I've just resolved the merge conflicts in runtime.ts and ensured everything is up to date with the latest main branch.

This PR is ready for review whenever you have a moment. It significantly improves the DX with better types and centralized logging. Let me know if you'd like any further adjustments! Thanks

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.

1 participant