Debug with structured logging

RSS for tag

Discuss the WWDC23 Session Debug with structured logging

Posts under wwdc2023-10226 tag

4 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

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
3
0
896
Oct โ€™23
Cannot get incremental logs from OSLogStore
Hello folks, I would like to incrementally retrieve logs of my iOS App from the Unified Logging System using OSLogStore. First I initialize the store store = try OSLogStore(scope: .currentProcessIdentifier) Second I set a position from which I want the logs using either : position = store.position(timeIntervalSinceLatestBoot: 0) // to get the logs from the launch of the App position = store.position(date: Date().addingTimeInterval(-10)) // to get the logs of the last 10 seconds Third I get the entries in the store from the position store.getEntries(at: position) Issue Whatever the position I set using from OSLogStore: position(timeIntervalSinceLatestBoot:) position(date:) position(timeIntervalSinceEnd:) All the logs are retrieved. I cannot get only the subset requested by the timeframe I specified Sample A sample LogScreen that has 2 buttons is attached to the post 1 to fetch logs since the last time they have been fetched 1 to add a log The code has been simplified to ease the comprehension of the case, please be indulgent to the shortcuts that have been taken. LogScreen.swift References https://developer.apple.com/documentation/oslog/oslogstore https://developer.apple.com/forums/thread/705868 https://developer.apple.com/videos/play/wwdc2023/10226/ Environment XCode 15b7 iPhone 14 Pro / iOS 17
1
1
670
Sep โ€™23
Xcode 15 structured logging not working for existing project
Using the latest Xcode 15 Beta 7: In an existing project, I can't get structured logging to work as described. For new projects, it works fine but I must have some setting or value in an existing project that prevents it from working. My simple text case: In an existing project file: @main struct LuarasBooksApp: App { var body: some Scene { WindowGroup { Text("hi") .onAppear { Logger(subsystem: "test", category: "test").error("help me") } } } } The debug console looks like this: That same code in a new project for the same Xcode 15 Beta 7 looks correct: Are there any settings, variables, etc... related to logging or the console that might cause this difference? In the existing project it makes no difference to toggle the various metadata options on and off. Thanks!
5
2
3.4k
Aug โ€™23