From 4dbc4ebeb227f1a85483a5a9cdd60d57174fce4c Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Thu, 11 May 2023 20:46:25 -0400 Subject: [PATCH] Include fractional seconds in log timestamps --- Tusker/Logging.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Tusker/Logging.swift b/Tusker/Logging.swift index 61cc117b..1c3c0ad2 100644 --- a/Tusker/Logging.swift +++ b/Tusker/Logging.swift @@ -22,12 +22,13 @@ struct Logging { let entries = try store.getEntries() var data = Data() let subsystem = Bundle.main.bundleIdentifier! + let format = Date.ISO8601FormatStyle(includingFractionalSeconds: true) for entry in entries { guard let entry = entry as? OSLogEntryLog, entry.subsystem == subsystem else { continue } - data.append(contentsOf: entry.date.formatted(.iso8601).utf8) + data.append(contentsOf: entry.date.formatted(format).utf8) data.append(32) // ' ' data.append(91) // '[' data.append(contentsOf: entry.category.utf8)