Skip to content

Instantly share code, notes, and snippets.

@yannxou
Created June 7, 2024 10:17
Show Gist options
  • Save yannxou/c973f998a9a5f8cd13b3bed516ab4cc7 to your computer and use it in GitHub Desktop.
Save yannxou/c973f998a9a5f8cd13b3bed516ab4cc7 to your computer and use it in GitHub Desktop.
Xcode Logger formatting with optional parameters
// https://developer.apple.com/wwdc20/10168
let statisticsLogger = Logger (subsystem: "com.example.Fruta", category: "statistics")
// Log statistics about communication with a server.
func logStatistics(taskID: UUID, giftCardID: String, serverID: Int, seconds: Double) {
statisticsLogger.log("\(taskID) \(giftCardID, align: .left(columns: GiftCard.maxIDLength)) \(serverID) \(seconds, format: .fixed(precision: 2))")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment