A nice feature in iOS, that already exists since iOS 10, is os_log . It is a somewhat obscure feature that little people use or know about. That's why I want to give a small introduction on how we use this logging mechanism in our apps.
In short, os_log makes it possible for you to add logs to your application in a more structured way. It allows you to filter your logs in the Console.app application. This way, you get a better view on why a certain error occurred. You can see it as an advanced version of the Xcode Console.
Structure your logs
There are two important properties that you can pass to the os_log function through OSLog: subsystem and category.
The subsystem is the identifier that represents the part of your application that performs the logging, for example a Today extension. You can use this identifier to filter your logs in the Console application. The category allows you to group your logs within a subsystem. This way you can get a clear overview of the logs that are triggered and for what reason.
How to use them is simple. Just create an OSLog object and pass this to os_log function.