Repository navigation
Conversation
Replace Effect's pretty and structured loggers with one that prints a `time LEVEL Msg key=value (12ms)` line, or a flat JSON record with `level`, `time`, `msg`, the annotations, and `error`. An error prints as `Name: message` with one `cause:` line per cause. Only an error without a `_tag`, which is a bug, keeps its stack; a tagged error's stack points into typewriter and is noise. - Give the tagged errors that had an empty message (the RPC errors, DbError, BlockNotFoundError, NoDataReturnedError, EncodeMutationError, UnknownMutationError, SignTransactionError, ProgramStoppedError, TypewriterStoppedError, UnrecoverableReorgError) a message. Revert messages include the decoded error and its arguments. - Throw ConfigError instead of Error from config validation and Solidity parsing. A forge build failure includes forge's output. - Provide the logger once at the edges, in createTypewriter and in the simulation entrypoint, instead of in typewriter.ts. The simulation logs at Info and applies TYPEWRITER_LOG_LEVEL to the runtime only, so the `None` level workaround and the `category: sim` annotation go. - createTypewriter logs a startup failure or a stopped program and exits with code 1, instead of an uncaught throw that Bun prints with a code frame and stack. - Log a rejected mutation at debug: the caller gets the error. - Use capitalized, past-tense messages and snake_case keys, and make each simulation log say it is part of the simulation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kyscott18
force-pushed
the
logs-and-errors
branch
from
October 27, 2026 13:42
6bb30d4 to
98e04ad
Compare
Read log durations from the Clock's monotonic time instead of performance.now(), so a simulation logs virtual durations that repeat for a seed. The simulation clock's nanosecond time rounds a fractional millisecond, which BigInt rejected. Reword the lowercase ConfigError messages and the revm halt errors to the sentence-case tone of the other messages: "Could not find …", "Expected X to have Y", and "halted with <reason>" like "reverted with". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Logs and errors now print in ponder's format, in both pretty and JSON. An error prints its message and its causes. Stacks are printed only for unknown errors (bugs), not for typewriter's own tagged errors.
Output
Pretty:
JSON (one line per log):
{"level":"error","time":"2026-10-26T17:29:05.358Z","msg":"Stopped typewriter","error":{"name":"TypewriterStoppedError","message":"Typewriter stopped","cause":{"name":"DbError","message":"Failed database query: select 1","sql":"select 1","cause":{"name":"PostgresError","message":"relation \"foo\" does not exist"}}}}Changes
src/logger.ts): a single logger replaces Effect's pretty and structured loggers.time LEVEL Msg key=value (duration).level,time,msg, the annotations, anderror.Errormessage arguments, anerrorannotation, and the EffectCause._tagmarks a known error, which prints asName: message. Any other error keeps its stack. Causes never print stacks.messagenow have one. This includes the RPC errors (RpcResponseErrorused to log as a bareRpcResponseError:),DbError,BlockNotFoundErrorand the revert errors.ConfigError: config validation and Solidity parsing throw it instead ofError. A forge build failure includes forge's output.createTypewriterand in the simulation entrypoint, no longer intypewriter.ts.TYPEWRITER_LOG_LEVELapplies only to the runtime. This removes theNonelevel workaround and thecategory: simannotation.Behavior changes to review
createTypewriterexits the process on a startup failure, instead of rejecting. It logs "Failed to start typewriter" and callsprocess.exit(1). Bun ignores an overwrittenerror.stackand always prints a code frame and stack for an uncaught error, so letting the error escape would bring the noise back. A stopped program already crashed the process; it now logs "Stopped typewriter" first. Previously only typed failures crashed it, and a defect stopped the program silently.messagebecomesmsg, annotations are flat instead of nested, and levels are lowercase.createTypewriterEffectdirectly gets Effect's default logger unless it providesloggerLayeritself.Testing
tsc --noEmit,biome check,bun test(27 pass)0x01passes at the default level and atTYPEWRITER_LOG_LEVEL=debug🤖 Generated with Claude Code