Skip to content

Debug Events Plugin - Log all events for debugging #59

@renaudcepre

Description

@renaudcepre

Summary

Create a plugin that captures and logs all events for debugging purposes.

Use Cases

  • Debugging - Understand why something fails by seeing the exact event sequence
  • Learning - See how ProTest events flow in a real run
  • Plugin development - Verify what data handlers receive
  • Bug reports - Attach complete event log for troubleshooting

Proposed Design

class DebugEventsPlugin(PluginBase):
    name = "debug-events"
    description = "Log all events for debugging"

Activation

protest run tests:session --debug-events           # Output to .protest/debug-events.log
protest run tests:session --debug-events=stderr    # Output to stderr

Output Format

Human-readable with relative timestamps:

[0.000s] SESSION_START
[0.001s] SUITE_START: "API"
[0.002s] TEST_START: name=test_login, node_id=module::API::test_login
[0.003s] TEST_ACQUIRED: name=test_login
[0.004s] FIXTURE_SETUP_START: name=db, scope=session
[0.008s] FIXTURE_SETUP_DONE: name=db, duration=4ms
[0.009s] TEST_SETUP_DONE: name=test_login
[0.015s] TEST_PASS: name=test_login, duration=11ms

Implementation Notes

  • Plugin implements all on_* handlers
  • Each handler logs event name + relevant data fields
  • Timestamps relative to session start
  • Default output: .protest/debug-events.log
  • No JSON format needed (human debugging tool)

Open Questions

  • Should it also log HANDLER_START/END meta-events? (might be noisy)
  • Truncate large data fields (e.g., test output)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestpluginPlugin system

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions