From 2b22af6163b95f023e616598094f7e51b1712a82 Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Mon, 3 Jun 2024 11:14:59 -0700 Subject: [PATCH] Add the mesh log to the logger --- Meshtastic/Helpers/Logger.swift | 2 +- Meshtastic/Helpers/MeshLogger.swift | 2 ++ Meshtastic/Views/Settings/MeshLog.swift | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Meshtastic/Helpers/Logger.swift b/Meshtastic/Helpers/Logger.swift index c94a6003..bf9ad575 100644 --- a/Meshtastic/Helpers/Logger.swift +++ b/Meshtastic/Helpers/Logger.swift @@ -7,7 +7,7 @@ extension Logger { /// All logs related to data such as decoding error, parsing issues, etc. static let data = Logger(subsystem: subsystem, category: "🗄️ Data") - + /// All logs related to the mesh static let mesh = Logger(subsystem: subsystem, category: "🕸️ Mesh") diff --git a/Meshtastic/Helpers/MeshLogger.swift b/Meshtastic/Helpers/MeshLogger.swift index accebd02..25dbc8f1 100644 --- a/Meshtastic/Helpers/MeshLogger.swift +++ b/Meshtastic/Helpers/MeshLogger.swift @@ -32,6 +32,8 @@ class MeshLogger { fileHandle.closeFile() } else { try data.write(to: logFile, options: .atomicWrite) + let log = String(data: data, encoding: .utf8) ?? "unknown".localized + Logger.mesh.notice("\(log)") } } catch { Logger.mesh.error("Error writing mesh log data: \(error.localizedDescription)") diff --git a/Meshtastic/Views/Settings/MeshLog.swift b/Meshtastic/Views/Settings/MeshLog.swift index 20fdf9d3..10575098 100644 --- a/Meshtastic/Views/Settings/MeshLog.swift +++ b/Meshtastic/Views/Settings/MeshLog.swift @@ -18,7 +18,7 @@ struct MeshLog: View { let url = logFile! logs.removeAll() var lineCount = 0 - let lineLimit = 500 + let lineLimit = 5000 // Get the number of lines for try await _ in url.lines { lineCount += 1