OSLog and Unified logging as recommended by Apple

OSLog and Unified logging as recommended by Apple

OSLog as a replacement of print and NSLog is the recommended way of logging by Apple. It’s a bit harder to write, but it comes with some nice advantages compared to it’s better-known friends.

[…]

Note: if you’re using iOS 14 and up, there are new APIs available explained further down this post.

[…]

All previous covered explanations in this blogpost still apply and the code examples are still working on iOS 14. However, if you’re supporting iOS 14 and up you might want to go with the improved APIs as they look nicer and come with a few new features.

[…]

We can fix this with the new alignment APIs in Swift:

[…]