In WWDC23 https://developer.apple.com/videos/play/wwdc2023/10226/, the new debugging was released.
import OSLog
let logger = Logger(subsystem: "You system", category: "Account")
func doSomething() {
logger.info("start")
// ...
if error {
logger.error("got error with: \(error)")
} else {
logger.notice("succeed!")
}
// ...
}
By doing such thing, you will completely have a free categorized debugging window in Xcode, with category and subsystem filter.
The icing on the cake is that, you can see this in the instrument and this logger will also capture some trace info!
You can see the debugger view in Xcode has different color for different logging level!