One of my favourite features in recent years was Apple’s introduction of OSLog, which in subsequent years has seen significant improvement via the use of Swift’s StringInterpolation features.

Separately Apple also open sourced a great little project called SwiftLog which tries to establish a common API the ecosystem can use (including non-Apple platforms) for consistent logging.

Some of its benefits include:

  • No predefined logging backend is enforced (you could just use print or something else entirely)
  • Built in support for log levels
  • Clean separation between the logger and the backend logging system

OSLog on the other hand includes a few features not present in this library:

  • Privacy by default
  • Various output formatters (i.e. padded integers, float precision, etc…)
  • Faster performance

String Interpolation

I decided to set out and see if I could add StringInterpolation to Apple’s SwiftLog library, adding in those missing features.

The result is a simple addition to Apple’s own library that enables an identical API, ensuring logging privacy is inferred by default.

Example logs

Note, while my library does provide the same API and similar output, due to its more ‘eager’ implementation, it cannot match the performance found in OSLog.


Together with Apple’s SwiftLog itself, the library therefore includes the following features:

  • Configurable log handler
  • Privacy (public, private and mask)
  • Numerical formatting (precision, padding)
  • Column alignment (coming soon)
  • and more coming soon

I’m releasing this library in the hopes its useful to others with a similar desire.