Skip to content

Add timestamps to debug trace output#117

Open
officialasishkumar wants to merge 1 commit intomagic-wormhole:mainfrom
officialasishkumar:111.debug-timestamps
Open

Add timestamps to debug trace output#117
officialasishkumar wants to merge 1 commit intomagic-wormhole:mainfrom
officialasishkumar:111.debug-timestamps

Conversation

@officialasishkumar
Copy link
Copy Markdown

The --debug option writes magic-wormhole state-machine transitions to a stream. That stream now gets wrapped before being passed to debug_set_trace, so each line is prefixed with elapsed seconds from fowl startup.

This keeps the magic-wormhole trace API unchanged and makes the logs easier to time and compare between peers.

Changes:

  • Add _TimestampedWriter, a small writable-stream wrapper that prefixes each new line with elapsed seconds.
  • Use it for config.debug_file in create_fowl.
  • Add a unit test for line-prefixing across partial writes.
  • Add a NEWS entry.

Validation:

  • python -m pytest --assert=plain --disable-warnings -q src/fowl/test/test_commands.py -k timestamped
  • python -m pytest --assert=plain --disable-warnings -q src/fowl/test/test_commands.py
  • python -m ruff check src/
  • git diff --check

Note: I also started the full src/fowl/test unit command, but stopped it after it exceeded the 60 second CI timeout shape locally; terminating it caused Twisted subprocess teardown failures, so I did not count that as a validation run.

Fixes #111

Wrap the --debug state-machine trace stream so each emitted line is prefixed with elapsed seconds from fowl startup. This keeps the magic-wormhole debug_set_trace API unchanged while making transition logs easier to compare and time.

Add a focused unit test for line-prefixing behavior and document the change in NEWS.

Fixes magic-wormhole#111
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.

timestamps on state-machine debug messages

1 participant