← ClaudeAtlas

oslog-logger-defaultslisted

Set up logging for an Apple-platform Swift app with `os.Logger` and decide its `subsystem` / `category` naming and `privacy:` interpolation. Use when choosing a logging library (`os.Logger` vs swift-log `import Logging` vs CocoaLumberjack); when writing the first `Logger(subsystem:category:)`; when deciding `.private` vs `.public` for a value; when asked what `.private` hides in Console.app, sysdiagnose, or `OSLogStore`. Does NOT cover `os_signpost` / Instruments profiling (ios-performance-engineering) or fanning logs out to trackers (telemetry-facade-pattern).
wei18/apple-dev-skills · ★ 19 · AI & Automation · score 78
Install: claude install-skill wei18/apple-dev-skills
# OSLog / `os.Logger` Defaults ## When to invoke - Starting a new Apple-platform project and picking a logging library. - Writing the first `Logger` declaration. - Deciding the default for privacy interpolation. - User asks "OSLog vs SwiftLog vs Sentry / CocoaLumberjack", "`.private` vs `.public` how to pick". ## Default decisions - **Use Apple's built-in `os.Logger`** (`import os`); **do not pull in any third-party logging library**. - Naming conventions: - `subsystem` = bundle ID (e.g. `com.example.myapp`) - `category` = module name (aligned with the SwiftPM target name) - **Privacy interpolation is type-dependent, not "all private"**: dynamic strings and complex objects default to `.private`; integer, floating-point, and Boolean values default to `.public`. Any identifying numeric value (player ID, user ID, serial number) must be marked `.private` explicitly. ```swift import os extension Logger { static let engine = Logger(subsystem: "com.example.myapp", category: "Engine") } Logger.engine.info("user \(userId, privacy: .public) loaded puzzle \(puzzleId, privacy: .private)") // ^^^^^^^ explicit public ^^^^^^^ explicit private — // identifying values need this // even when the type (Int, Bool) // would otherwise default pu