feature: Write logs into a file
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 56
- Forks
- 21
- PR merge metrics
- No merged PRs in 30d
Description
🗣 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
PactSwiftMockServerpackage and intopactffi. - 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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at MockService.init(log: URL? = nil) and trace how PactSwiftMockServer calls pactffi and passes the log-writing signal. Inspect how defaultPactsDir is selected for contract files. Done means a supplied URL receives logs after pact tests finish, while an omitted URL writes them under defaultPactsDir/logs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100