fix: gate networkmock logging
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 52/100
Research direction
Start by checking for an existing shared logging convention, then inspect the println call sites in MockConfigRepository.kt, MockStateRepository.kt, and NetworkMockPlugin.kt. Review MockConfigRepositoryTest.kt and NetworkMockPluginTest.kt for output assertions; done means all listed logging is gated, host apps can disable it, and response bodies are never logged.
Written by the indexing model from the issue text.
Description
Summary
devview-networkmock-core and devview-networkmock-ktor emit roughly 65 unconditional println calls covering every step of config loading, request matching, and response serving. These ship straight into any host app's logcat, unconditionally, with no way to turn them off — and several of them log full request URLs and response bodies. This is independent of the OpenAPI migration (tracked in the epic, #72) and can be picked up any time.
Current state
Two hot spots:
MockConfigRepository—devview-networkmock-core/src/commonMain/kotlin/com/worldline/devview/networkmock/core/repository/MockConfigRepository.kt, roughly 25printlncalls acrossloadConfiguration()(:206-252) andfindMatchingMock()(:292-377), including per-group and per-environment iteration logging and full path/method/query comparison traces on every single intercepted request.NetworkMockPlugin—devview-networkmock-ktor/src/commonMain/kotlin/com/worldline/devview/networkmock/ktor/plugin/NetworkMockPlugin.kt, roughly 40printlncalls (LOG_PREFIXconstant at:37) covering plugin install, every intercepted request's host/path/method (:170), full mock-vs-network decision tracing, and — notably — the response file name and status code on every successful mock (:248-249).MockStateRepositoryalso logs on every state write (setGlobalMockingEnabled:240,245,setEndpointMockState:271-273,setAllEndpointStates:334-336, all indevview-networkmock-core/src/commonMain/kotlin/com/worldline/devview/networkmock/core/repository/MockStateRepository.kt).
None of this is gated behind a log level, a debug flag, or a way to disable it. A host app integrating this library gets this in its logcat/console on every request, all the time, with no opt-out — and depending on mock content, response bodies could contain data a team doesn't want silently duplicated into device logs.
What to build
Introduce a minimal logging abstraction (or reuse one if this repo already has a shared logging convention elsewhere in DevView — check before adding a new one) with at least an on/off gate, defaulting to a sensible state for a developer tool (arguably on-by-default is fine for a dev-only overlay tool, but it must be possible to turn off, and it should not be the current firehose of ~40+ lines per single request).
Suggested minimal shape: a single NetworkMockLogger (or similar) with a enabled: Boolean toggle, injected the same way NetworkMockResourceLoader already is, replacing every println call site. Consider consolidating the current multi-line-per-request tracing into a single structured log line per request (e.g. one line: method path -> MOCK|NETWORK (reason)), which both reduces log volume and reduces sensitive-data exposure (drop full response bodies from logs entirely — the status code and file/example name is enough context).
Acceptance criteria
- All ~65
printlncalls acrossdevview-networkmock-coreanddevview-networkmock-ktorare replaced with a gated logging call. - Logging can be disabled entirely by a host app.
- No response body content is ever logged (status code + example identifier is sufficient).
- Existing tests that assert on
printlnoutput (if any — checkMockConfigRepositoryTest.kt,NetworkMockPluginTest.kt) are updated accordingly.
Files likely touched
devview-networkmock-core/src/commonMain/kotlin/com/worldline/devview/networkmock/core/repository/MockConfigRepository.ktdevview-networkmock-core/src/commonMain/kotlin/com/worldline/devview/networkmock/core/repository/MockStateRepository.ktdevview-networkmock-ktor/src/commonMain/kotlin/com/worldline/devview/networkmock/ktor/plugin/NetworkMockPlugin.kt- New shared logging utility, likely in
devview-networkmock-core
- Dominant language
- Kotlin
- Stars
- 10
- Forks
- 2
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 13
Contributor guide
No contributing guide indexed for this repository
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.
More from worldline/devview
-
enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 45/100
All issues in worldline/devview
Similar issues
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Richie97/track-history#325 ·
-
bug CLI documentation reliability
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
KW-related Type:bug UI / UX
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
RevenueCat/purchases-android#4299 · 1 comment ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
AAswordman/Operit#1265 · 3 comments ·