Emoji in the logs

This commit is contained in:
Garth Vander Houwen 2024-06-03 10:23:20 -07:00
parent 847892d45d
commit cd0f7dd9d6
4 changed files with 19 additions and 23 deletions

View file

@ -62,7 +62,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate
func startScanning() {
if isSwitchedOn {
centralManager.scanForPeripherals(withServices: [meshtasticServiceCBUUID], options: [CBCentralManagerScanOptionAllowDuplicatesKey: false])
Logger.data.info("✅ Scanning Started")
Logger.services.info("✅ Scanning Started")
}
}
@ -2988,7 +2988,7 @@ extension BLEManager: CBCentralManagerDelegate {
// MARK: Bluetooth enabled/disabled
func centralManagerDidUpdateState(_ central: CBCentralManager) {
if central.state == CBManagerState.poweredOn {
Logger.services.debug("BLE powered on")
Logger.services.debug("🔌 BLE powered on")
isSwitchedOn = true
startScanning()
} else {
@ -3013,7 +3013,7 @@ extension BLEManager: CBCentralManagerDelegate {
default:
status = "default"
}
Logger.services.debug("BLEManager status: \(status)")
Logger.services.debug("📜 BLEManager status: \(status)")
}
// Called each time a peripheral is discovered

View file

@ -50,7 +50,7 @@ import OSLog
if self.manager.authorizationStatus == .notDetermined {
self.manager.requestWhenInUseAuthorization()
}
Logger.services.info("Starting location updates")
Logger.services.info("📍 Starting location updates")
Task {
do {
self.updatesStarted = true
@ -70,14 +70,14 @@ import OSLog
}
}
} catch {
Logger.services.error("Could not start location updates: \(error.localizedDescription)")
Logger.services.error("💥 Could not start location updates: \(error.localizedDescription)")
}
return
}
}
func stopLocationUpdates() {
Logger.services.info("Stopping location updates")
Logger.services.info("🛑 Stopping location updates")
self.updatesStarted = false
}
@ -85,15 +85,15 @@ import OSLog
if smartPostion {
let age = -location.timestamp.timeIntervalSinceNow
if age > 10 {
Logger.services.warning("Bad Location \(self.count): Too Old \(age) seconds ago \(location)")
Logger.services.warning("📍 Bad Location \(self.count): Too Old \(age) seconds ago \(location)")
return false
}
if location.horizontalAccuracy < 0 {
Logger.services.warning("Bad Location \(self.count): Horizontal Accuracy: \(location.horizontalAccuracy) \(location)")
Logger.services.warning("📍 Bad Location \(self.count): Horizontal Accuracy: \(location.horizontalAccuracy) \(location)")
return false
}
if location.horizontalAccuracy > 5 {
Logger.services.warning("Bad Location \(self.count): Horizontal Accuracy: \(location.horizontalAccuracy) \(location)")
Logger.services.warning("📍 Bad Location \(self.count): Horizontal Accuracy: \(location.horizontalAccuracy) \(location)")
return false
}
}

View file

@ -5,18 +5,15 @@ extension Logger {
/// The logger's subsystem.
private static var subsystem = Bundle.main.bundleIdentifier!
// NOTE: Replace the categories below with your own choosing.
/// All logs related to data such as decoding error, parsing issues, etc.
static let data = Logger(subsystem: subsystem, category: "data")
static let data = Logger(subsystem: subsystem, category: "🗄️ Data")
/// All logs related to data such as decoding error, parsing issues, etc.
static let mesh = Logger(subsystem: subsystem, category: "mesh")
/// All logs related to the mesh
static let mesh = Logger(subsystem: subsystem, category: "🕸️ Mesh")
/// All logs related to services such as network calls, location, etc.
static let services = Logger(subsystem: subsystem, category: "services")
static let services = Logger(subsystem: subsystem, category: "🍏 Services")
/// All logs related to tracking and analytics.
static let statistics = Logger(subsystem: subsystem, category: "statistics")
static let statistics = Logger(subsystem: subsystem, category: "📈 Stats")
}

View file

@ -140,7 +140,7 @@ struct MeshtasticAppleApp: App {
.onChange(of: scenePhase) { (newScenePhase) in
switch newScenePhase {
case .background:
Logger.services.info("Scene is in the background")
Logger.services.info("🍏 Scene is in the background")
do {
try persistenceController.container.viewContext.save()
@ -148,14 +148,14 @@ struct MeshtasticAppleApp: App {
} catch {
Logger.services.error("Failed to save viewContext when the app goes to the background.")
Logger.services.error("💥 Failed to save viewContext when the app goes to the background.")
}
case .inactive:
Logger.services.info("Scene is inactive")
Logger.services.info("🍏 Scene is inactive")
case .active:
Logger.services.info("Scene is active")
Logger.services.info("🍏 Scene is active")
@unknown default:
Logger.services.error("Apple must have changed something")
Logger.services.error("🍎 Apple must have changed something")
}
}
}
@ -168,6 +168,5 @@ class AppState: ObservableObject {
@Published var unreadDirectMessages: Int = 0
@Published var unreadChannelMessages: Int = 0
@Published var firmwareVersion: String = "0.0.0"
// @Published var connectedNode: NodeInfoEntity?
@Published var navigationPath: String?
}