mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Adjust log timing
This commit is contained in:
parent
d5884988b1
commit
d12c755eb9
2 changed files with 3 additions and 7 deletions
|
|
@ -25,10 +25,10 @@ extension Logger {
|
|||
static let statistics = Logger(subsystem: subsystem, category: "📈 Stats")
|
||||
|
||||
/// Fetch from the logstore
|
||||
static public func fetch(since date: Date, predicateFormat: String) async throws -> [OSLogEntryLog] {
|
||||
static public func fetch(predicateFormat: String) async throws -> [OSLogEntryLog] {
|
||||
|
||||
let store = try OSLogStore(scope: .currentProcessIdentifier)
|
||||
let position = store.position(date: date)
|
||||
let position = store.position(timeIntervalSinceLatestBoot: 0)
|
||||
let predicate = NSPredicate(format: predicateFormat)
|
||||
let entries = try store.getEntries(at: position, matching: predicate)
|
||||
|
||||
|
|
|
|||
|
|
@ -98,17 +98,13 @@ extension AppLog {
|
|||
|
||||
@MainActor
|
||||
private func fetchLogs() async -> [OSLogEntryLog] {
|
||||
let calendar = Calendar.current
|
||||
guard let dayAgo = calendar.date(byAdding: .day, value: -1, to: Date.now) else {
|
||||
return []
|
||||
}
|
||||
do {
|
||||
let predicate = AppLog.template.withSubstitutionVariables(
|
||||
[
|
||||
"PREFIX": "gvh.MeshtasticClient",
|
||||
"SYSTEM": ["com.apple.coredata"]
|
||||
])
|
||||
let logs = try await Logger.fetch(since: dayAgo, predicateFormat: predicate.predicateFormat)
|
||||
let logs = try await Logger.fetch(predicateFormat: predicate.predicateFormat)
|
||||
return logs
|
||||
} catch {
|
||||
return []
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue