Skip to content

feat: expose buffered plugin log entries - #1732

Draft
JP-Ellis wants to merge 1 commit into
feat/logging-test-run-idfrom
feat/plugin-logs
Draft

JP-Ellis wants to merge 1 commit into
feat/logging-test-run-idfrom
feat/plugin-logs

Conversation

@JP-Ellis

@JP-Ellis JP-Ellis commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

✈️ Pre-flight checklist

  • I have read the Contributing Guidelines on pull requests.
  • If this is a code change: I have written unit tests and/or added dogfooding pages to fully verify the new behavior.
  • If this is a new API or substantial change: the PR has an accompanying issue (closes #0000) and the maintainers have approved on my working plan.

📝 Summary

Adds pact.plugins.get_logs, which returns the log entries the FFI buffers for a plugin instance as PluginLogEntry objects. Each entry carries the plugin name, timestamp and source, in addition to the fields on the forwarded pact.plugins records.

Stacked on #1731.

🔥 Motivation

Forwarding already delivers every plugin entry through logging. Buffered access suits code which inspects a plugin's output after the fact, such as a test asserting on what a plugin logged. The plugin instance ID comes from the plugin_instance_id attribute of a forwarded record.

🔨 Test Plan

  • Unit tests for the conversion from the FFI's entries.
  • An end-to-end test which loads the fake plugin and reads its entries back. It is skipped on Windows.

🔗 Related issues/PRs

The Pact library buffers every plugin log entry for the lifetime of the
process, keyed by plugin instance. Add pact.plugins with `get_logs`,
which returns them as `PluginLogEntry` objects.

Forwarding through `logging` already delivers each entry with its
instance ID, test run ID and target. A buffered entry adds the plugin
name, the time the library recorded it and its source: a line on the
plugin's stderr, or a structured record sent over the plugin protocol.
`get_logs` also reaches entries recorded before the caller attached a
handler.

The instance ID is only reported on the forwarded records, so
`get_logs` is used together with them. A fake plugin under
PACT_PLUGIN_DIR covers that path end to end.

Signed-off-by: JP-Ellis <josh@jpellis.me>
Assisted-by: Claude Code:claude-opus-5-5
@JP-Ellis
JP-Ellis added this pull request to stack #1733 October 16, 2026 00:37

This branch has not been deployed

No deployments
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.

1 participant