From 481b515ed009edfc274418dd30e7501c2b8bd469 Mon Sep 17 00:00:00 2001 From: Morgan Pretty Date: Fri, 10 May 2024 13:12:45 +1000 Subject: [PATCH] Logging testing --- LibSession-Util | 2 +- SessionUtilitiesKit/LibSession/LibSession.swift | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/LibSession-Util b/LibSession-Util index 6744a7de2..610965b41 160000 --- a/LibSession-Util +++ b/LibSession-Util @@ -1 +1 @@ -Subproject commit 6744a7de2fdfcca739d7cda75f96a16d6e455914 +Subproject commit 610965b417709e77c7f3b832dae6fce75088c198 diff --git a/SessionUtilitiesKit/LibSession/LibSession.swift b/SessionUtilitiesKit/LibSession/LibSession.swift index f524fb07e..3f17d541e 100644 --- a/SessionUtilitiesKit/LibSession/LibSession.swift +++ b/SessionUtilitiesKit/LibSession/LibSession.swift @@ -9,7 +9,8 @@ import SignalCoreKit public enum LibSession { private static let logLevels: [LogCategory: LOG_LEVEL] = [ .config: LOG_LEVEL_INFO, - .network: LOG_LEVEL_INFO + .network: LOG_LEVEL_INFO, + .manual: LOG_LEVEL_INFO, ] public static var version: String { String(cString: LIBSESSION_UTIL_VERSION_STR) } @@ -19,15 +20,15 @@ public enum LibSession { extension LibSession { public static func addLogger() { - // Set the default log level first (in case something has a warning or error) + /// Set the default log level first (unless specified we only care about semi-dangerous logs) session_logger_set_level_default(LOG_LEVEL_WARN) - // Then set any explicit category log levels we have + /// Then set any explicit category log levels we have logLevels.forEach { cat, level in session_logger_set_level(cat.rawValue.cArray, level) } - // Finally register the actual logger callback + /// Finally register the actual logger callback session_add_logger_full({ msgPtr, msgLen, _, _, lvl in guard let msg: String = String(pointer: msgPtr, length: msgLen, encoding: .utf8) else { return } @@ -56,6 +57,7 @@ extension LibSession { case config case network case quic + case manual init?(_ catPtr: UnsafePointer?, _ catLen: Int) { switch String(pointer: catPtr, length: catLen, encoding: .utf8).map({ LogCategory(rawValue: $0) }) {