toll-booth emits onRequest, onChallenge, and onPayment callbacks that give operators visibility into the payment flow. There is no example showing how to wire these into a structured logging setup (JSON lines, pino, etc.). A working example would help operators monitor their deployments in production.
Scope
- Create
examples/structured-logging/ with a minimal Express server
- Wire
onRequest, onChallenge, and onPayment callbacks to produce JSON log lines to stdout
- Include fields like timestamp, client IP, route, amount, payment hash, and credit balance
- Add a
README.md explaining the callback signatures and when each fires
Helpful context
src/types.ts lines 347-349 - the three event callback signatures (onPayment, onRequest, onChallenge)
src/stats.ts - the built-in StatsCollector that uses these same callbacks internally
src/booth.ts lines 128-132 - how the Booth constructor wires user callbacks alongside stats collection
- Estimated effort: 1-2 hours
toll-booth emits
onRequest,onChallenge, andonPaymentcallbacks that give operators visibility into the payment flow. There is no example showing how to wire these into a structured logging setup (JSON lines, pino, etc.). A working example would help operators monitor their deployments in production.Scope
examples/structured-logging/with a minimal Express serveronRequest,onChallenge, andonPaymentcallbacks to produce JSON log lines to stdoutREADME.mdexplaining the callback signatures and when each firesHelpful context
src/types.tslines 347-349 - the three event callback signatures (onPayment,onRequest,onChallenge)src/stats.ts- the built-inStatsCollectorthat uses these same callbacks internallysrc/booth.tslines 128-132 - how the Booth constructor wires user callbacks alongside stats collection