Skip to content

feature: Write logs into a file #75

@surpher

Description

@surpher

🗣 Context

Currently the only way to display some logging is by setting an environment variable. It would be good to have the logs of interactions with the mock server written in a file.

💬 Narrative

When running pact tests
I want to have logs written into a file
So that I can debug locally and on CI much easier

📝 Notes

PactSwiftMockServer exposes a pactffi method that tells pactffi_mock_server to write the log buffer into a file.

🏗 Design

  • Exposes the interface ie MockService.init(log: URL? = nil)
  • Passes do write the log signal to PactSwiftMockServer package and into pactffi.
  • Uses the same base default directory for contract if no override provided (eg: /tmp/pacts/logs)

✅ Acceptance Criteria

GIVEN a valid URL to a log file is provided at MockService.init
WHEN pact tests finish
THEN a log file is generated at provided URL

GIVEN MockService is instantiated without an URL to a log file
WHEN pact tests finish
THEN a log file is generated at defaultPactsDir/logs

🚫 Out of Scope

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions