Meshtastic-Apple/Meshtastic/Extensions/OSLogEntryLog.swift
2025-04-27 12:50:45 -07:00

35 lines
738 B
Swift
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// OSLogEntryLog.swift
// Meshtastic
//
// Copyright(c) Garth Vander Houwen 6/28/24.
//
import OSLog
import SwiftUI
/// Extensions to allow rendering of the emoji string and log leve coloring in the grid of OSLogEntryLog items
extension OSLogEntryLog.Level {
var description: String {
switch self {
case .undefined: "undefined"
case .debug: "🪲 Debug"
case .info: " Info"
case .notice: "⚠️ Notice"
case .error: "🚨 Error"
case .fault: "💥 Fault"
@unknown default: "Default".localized
}
}
var color: Color {
switch self {
case .undefined: .green
case .debug: .indigo
case .info: .green
case .notice: .orange
case .error: .red
case .fault: .red
@unknown default: .green
}
}
}