Okay, so your version is working. Thanks again for the detailed examples (which I should've provided in the first place!)
I have a hunch why the old os_log
is not outputting anything is related to how the unified logging system is handling privacy. Let's say in your example, if I am to put:
logger.log("Hello Cruel \(planet)!")
When running without Xcode, it will output Hello Cruel <private> to the Console. I'd have to add Hello Cruel \(planet, privacy: .public)
for the full message to appear.
I assume, when using os_log
with format specifiers (%s) and CvarArg, it treats the whole message as private, and that's why it's not outputting anything when run without Xcode. I don't know if there's a way to specify public for the os_log
approach. One downside of using Logger is that it's bound to iOS 14, but we're supporting older versions.
Cheers