Oslog

Logging Messages With the Unified Logging System on Apple Platforms

Published on

Last time we talked about the basics of the Unified Logging System, we set the basic concepts and code we need to write logs, along with the different logging levels, and more.

In this article we will talk about actually logging messages, how the framework is “smart enough” to strip out sensitive user info by default, and how we can control what gets stripped.

Logging Messages

The framework supports interpolated strings right out of the box when you are using the new system in Swift.


Introduction to Apple's Unified Logging System on iOS 14 in Swift

Published on

It is no surprise that software tend to write logs to a local file as they execute. As events, errors, or exceptional situations occur, a lot of software takes note of them using a local logging solution. This is done because these practices can allow us to troubleshoot problems for our users, find bugs, and in general understand the behavior of our software in untested or lesser tested scenarios.

When comes to iOS and other Apple platforms, there have always been third party dependencies that allow you to do this. A lot of developers roll their own solution and write events in plain text files. It wasn’t until iOS 8 and macOS 10.10 that Apple provided us with a unified logging system that is easy to use and is very performant - OSLog.