oslog-logger-defaultslisted
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 defaults to `.private`**: all string interpolation is treated as private; `.public` must be marked 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)")
// ^^^^^^^ explicit public; puzzleId defaults to private
```
## Rationale
- Native integration with Console.app / Instruments / the unified logging system; zero dependencies.
- Friendly to Swift 6 actor / Sendable.
- Native privacy interpolation; `.private` content is automatically redacted in cross-device sysdiagnose.
- No third-party SDK pulled in → no extra entries in `PrivacyInfo.xcprivacy`, consistent with the "no third-party tracking" stance.
### What `.private` actually means (easily misunderstood)
- `.private` content is **redact