Meshtastic-Apple/Meshtastic/Views/Helpers/LogDetail.swift
Garth Vander Houwen 544bbd3621 Debug log updates
2024-06-05 20:46:24 -07:00

129 lines
2.8 KiB
Swift

//
// LogDetail.swift
// Meshtastic
//
// Copyright(c) Garth Vander Houwen 6/5/24.
//
import SwiftUI
import MapKit
import OSLog
@available(iOS 17.0, macOS 14.0, *)
struct LogDetail: View {
@Environment(\.dismiss) private var dismiss
var log: OSLogEntryLog
var body: some View {
VStack {
HStack {
Text("OS Log Entry Details")
.font(.largeTitle)
}
Divider()
HStack(alignment: .top) {
VStack(alignment: .leading) {
List {
/// Time
Label {
Text("time".localized + ":")
.font(.title)
LastHeardText(lastHeard: log.date)
.font(.title)
} icon: {
Image(systemName: "timer")
.symbolRenderingMode(.hierarchical)
.font(.title)
.frame(width: 35)
}
.padding(.bottom, 5)
/// Subsystem
Label {
Text("subsystem".localized + ":")
.font(.title)
Text(log.subsystem)
.font(.title)
} icon: {
Image(systemName: "gear")
.symbolRenderingMode(.hierarchical)
.font(.title)
.frame(width: 35)
}
.padding(.bottom, 5)
/// Process
Label {
Text("process".localized + ":")
.font(.title)
Text(log.process)
.font(.title)
} icon: {
Image(systemName: "tag")
.symbolRenderingMode(.hierarchical)
.font(.title)
.frame(width: 35)
}
.padding(.bottom, 5)
/// Category
Label {
Text("category".localized + ":")
.font(.title)
Text(log.category)
.font(.title)
} icon: {
Image(systemName: "rectangle.3.group")
.symbolRenderingMode(.hierarchical)
.font(.title)
.frame(width: 35)
}
.padding(.bottom, 5)
/// Level
Label {
Text("level".localized + ":")
.font(.title)
Text(log.level.description)
.font(.title)
} icon: {
Image(systemName: "shield")
.symbolRenderingMode(.hierarchical)
.font(.title)
.frame(width: 35)
}
.padding(.bottom, 5)
/// message
Label {
Text("message".localized + ":")
.font(.title)
Text(log.composedMessage)
.font(.title)
} icon: {
Image(systemName: "text.bubble")
.symbolRenderingMode(.hierarchical)
.font(.title)
.frame(width: 35)
}
.padding(.bottom, 5)
}
.listStyle(.plain)
}
Spacer()
}
.padding(.top)
#if targetEnvironment(macCatalyst)
Spacer()
Button {
dismiss()
} label: {
Label("close", systemImage: "xmark")
}
.buttonStyle(.bordered)
.buttonBorderShape(.capsule)
.controlSize(.large)
.padding(.bottom)
#endif
}
.presentationDetents([.fraction(0.65), .fraction(0.75), .fraction(0.85)])
.presentationDragIndicator(.visible)
}
}