-
-
Save erikng/4b47aad70c6a07a72d5a641251971c3f to your computer and use it in GitHub Desktop.
Revisions
-
steipete created this gist
Aug 24, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ let subsystem = "com.steipete.LoggingTest" func getLogEntries() throws -> [OSLogEntryLog] { // FB8269189: OSLogStore does not work iOS. let logStore = try OSLogStore(scope: .currentProcessIdentifier) let oneHourAgo = logStore.position(date: Date().addingTimeInterval(-3600)) #if os(macOS) let allEntries = try logStore.getEntries(at: oneHourAgo) #else // FB8518476: The Swift shims for for the entries enumerator are missing. let allEntries = try Array(logStore.__entriesEnumerator(position: oneHourAgo, predicate: nil)) #endif // FB8518539: Using NSPredicate to filter the subsystem doesn't seem to work. return allEntries .compactMap { $0 as? OSLogEntryLog } .filter { $0.subsystem == subsystem } }