Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
// for example, for debugging messages in `ViewController.swift`
private let log = OSLog(subsystem: Bundle.main.bundleIdentifier!, category: "ViewController")
private let log = OSLog.disabled
// and then:
// 1. Use `.debug` log for debugging messages, only shown if configuration is set to show debugging messages
// (and it's a memory-only log, by default).
// 2. Use `%{public}@" for strings that should be logged, but omit the `{public}` if not.
func foo(message: String) {
os_log(.debug, log: log, "%{public}@ message: %@", #function, message)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.