Setup:
Problem: The external developer can see the logs originating from my framework in plain text when running the app in iOS Simulator.
Sample code
private static let log = OSLog(subsystem: Constants.loggingSubsystem, category: String(describing: FrameworkName.self))
...
...
os_log("Network response: %@", log: Self.log, type: .debug, String(describing: response))
os_log("Network response data: %{private}@",
log: Self.log,
type: .debug,
String(data: data, encoding: .utf8)!)
Expected output: nothing, as both of the calls are set to be debug
, so they should not produce any output in the Release build.
At least, the 2nd call should not show the network response data in plain text.
Observed output: Network response & data are printed in plain text for the external developer.
The solution is to not use OSLog and use it with a solution like SwiftyBeaver https://github.com/SwiftyBeaver/SwiftyBeaver