Make request logging opt in, provide an ability to opt out or allow passing in a logger
ptrkstr opened this issue · comments
Short description of the issue:
When utilising URLSession+Rx.swift
, requests are logged in non-DEBUG environments as seen here. This gives the consumer of Rx no choice of opting out of these logs when developing.
Expected outcome:
One of these options would suffice:
- Make logs opt-in
- Allow logs to be opt-out
- Allow consumer to pass in a logger
What actually happens:
Consumer of Rx cannot opt-out of logs.
Self contained code example that reproduces the issue:
Any code that uses URLSession.rx.response(request:...
RxSwift/RxCocoa/RxBlocking/RxTest version/commit
On master as of commit: 04c8d2b491b54e46a3534254bed8807b4a954fad
Platform/Environment
- All platforms that use
URLSession.rx.response(request:...
How easy is to reproduce? (chances of successful reproduce after running the self contained code)
- easy, 100% repro
- sometimes, 10%-100%
- hard, 2% - 10%
- extremely hard, %0 - 2%
You can opt-out by simply adding this in your app delegate:
Reactive.shouldLogRequest = { _ in false }
Amazing thank you @danielt1263 !