Add timestamps to debug trace output#117
Open
officialasishkumar wants to merge 1 commit intomagic-wormhole:mainfrom
Open
Add timestamps to debug trace output#117officialasishkumar wants to merge 1 commit intomagic-wormhole:mainfrom
officialasishkumar wants to merge 1 commit intomagic-wormhole:mainfrom
Conversation
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
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.
The
--debugoption writes magic-wormhole state-machine transitions to a stream. That stream now gets wrapped before being passed todebug_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:
_TimestampedWriter, a small writable-stream wrapper that prefixes each new line with elapsed seconds.config.debug_fileincreate_fowl.Validation:
python -m pytest --assert=plain --disable-warnings -q src/fowl/test/test_commands.py -k timestampedpython -m pytest --assert=plain --disable-warnings -q src/fowl/test/test_commands.pypython -m ruff check src/git diff --checkNote: I also started the full
src/fowl/testunit 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