Include fractional seconds in log timestamps
This commit is contained in:
parent
fc391cc18c
commit
4dbc4ebeb2
|
@ -22,12 +22,13 @@ struct Logging {
|
||||||
let entries = try store.getEntries()
|
let entries = try store.getEntries()
|
||||||
var data = Data()
|
var data = Data()
|
||||||
let subsystem = Bundle.main.bundleIdentifier!
|
let subsystem = Bundle.main.bundleIdentifier!
|
||||||
|
let format = Date.ISO8601FormatStyle(includingFractionalSeconds: true)
|
||||||
for entry in entries {
|
for entry in entries {
|
||||||
guard let entry = entry as? OSLogEntryLog,
|
guard let entry = entry as? OSLogEntryLog,
|
||||||
entry.subsystem == subsystem else {
|
entry.subsystem == subsystem else {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
data.append(contentsOf: entry.date.formatted(.iso8601).utf8)
|
data.append(contentsOf: entry.date.formatted(format).utf8)
|
||||||
data.append(32) // ' '
|
data.append(32) // ' '
|
||||||
data.append(91) // '['
|
data.append(91) // '['
|
||||||
data.append(contentsOf: entry.category.utf8)
|
data.append(contentsOf: entry.category.utf8)
|
||||||
|
|
Loading…
Reference in New Issue