Structured logging with emoji or objectdescription

When running the code below, only the first entry gets logged. Structured logging seems not to work when there are emoticons or object descriptions in the message. Is this by design?

 let logger = Logger(subsystem: "TestSystem", category: "TestCategory")

        logger.log("👍") // Result = 👍
        
        let someEmoji:String = "👎"
        logger.log("\(someEmoji)") // Result = empty log line
        
        let someObjectDescription:String = String(describing:self)
        logger.log("\(someObjectDescription)") // Result = empty log line
Answered by TheMisfit68 in 767323022

Tested this again in the final release of Xcode 15 and it all works now as expected

It seems related to the privacy modifier

How are you testing this? Your use of the wwdc2023-10226 tag suggests that you’re using Xcode 15 beta, so I ran something like your test here in my office and I didn’t see a problem. Specifically:

  1. Using Xcode 15.0b6 on macOS 13.5, I created a new test project and wired up a button to the code below:

    import Foundation
    import os.log
    
    func test() {
        // subsystem:com.example.Test735869
        let logger = Logger(subsystem: "com.example.Test735869", category: "tool")
        logger.log("thumbs up: 👍")
        let someEmoji = "👎"
        logger.log("thumbs down: \(someEmoji)")
    }
    
  2. I ran the app on the iOS 17.0 beta simulator.

  3. I clicked my button.

  4. Xcode’s console (View > Debug Area > Activate Console) shows both log lines.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Accepted Answer

Tested this again in the final release of Xcode 15 and it all works now as expected

Structured logging with emoji or objectdescription
 
 
Q