taler-ios

iOS apps for GNU Taler (wallet)
Log | Files | Refs | README | LICENSE

commit 4fcc0b7d2974f414fe3d5b2d36a0254bf8748496
parent 3f9543770bf068de40157b99f7a7102b305a3818
Author: Marc Stibane <marc@taler.net>
Date:   Mon, 25 Nov 2024 20:21:58 +0100

Logging

Diffstat:
MTalerWallet1/Backend/WalletCore.swift | 20+++++++++++++-------
MTalerWallet1/Helper/Controller+playSound.swift | 2+-
2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/TalerWallet1/Backend/WalletCore.swift b/TalerWallet1/Backend/WalletCore.swift @@ -264,9 +264,9 @@ extension WalletCore { postNotification(.KYCrequired, userInfo: [TRANSACTIONTRANSITION: decoded]) return } - logger.log("Pending:\(newMinor.rawValue, privacy: .public) \(decoded.transactionId, privacy: .private(mask: .hash))") + logger.trace("Pending:\(newMinor.rawValue, privacy: .public) \(decoded.transactionId, privacy: .private(mask: .hash))") } else { - logger.log("Pending: \(decoded.transactionId, privacy: .private(mask: .hash))") + logger.trace("Pending: \(decoded.transactionId, privacy: .private(mask: .hash))") } postNotification(.TransactionStateTransition, userInfo: [TRANSACTIONTRANSITION: decoded]) default: @@ -414,7 +414,7 @@ print("\nā—ļø WalletCore.swift:343 NEW Notification: ", anyPayload, "\n") symLog.log("\"id\":\(decoded.id ?? 0) \(message)") try handleError(decoded) case "response": - symLog.log("\"id\":\(decoded.id ?? 0) \(message)") + symLog.log(message) try handleResponse(decoded) case "notification": // symLog.log(message) @@ -456,12 +456,18 @@ print("\nā—ļø WalletCore.swift:343 NEW Notification: ", anyPayload, "\n") self.completions[requestId] = (sendTime, completionHandler) self.requestsMade += 1 self.semaphore.signal() // free requestsMade - self.logger.log("sendRequest \(requestId, privacy: .public): \(request.operation, privacy: .public)") + let args = try JSONEncoder().encode(request.args) + if let jsonArgs = String(data: args, encoding: .utf8) { + self.logger.log("šŸ”“ \(request.operation, privacy: .public) (\(requestId, privacy: .public)) \(jsonArgs, privacy: .auto)") + } else { // should NEVER happen since the whole request was already successfully encoded and stringified + self.logger.log("šŸ”“ \(request.operation, privacy: .public) (\(requestId, privacy: .public)) šŸ”“ Error: jsonArgs") + } self.quickjs.sendMessage(message: jsonString) - self.symLog.log(jsonString) +// self.symLog.log(jsonString) } catch { // call completion - self.semaphore.signal() - self.symLog.log(error) + self.semaphore.signal() // free requestsMade + self.logger.error("\(error.localizedDescription)") +// self.symLog.log(error) completionHandler(requestId, sendTime, nil, WalletCore.serializeRequestError()); } } diff --git a/TalerWallet1/Helper/Controller+playSound.swift b/TalerWallet1/Helper/Controller+playSound.swift @@ -66,7 +66,7 @@ extension Controller { let fileURL = URL(fileURLWithPath: "/System/Library/Audio/UISounds/" + sound + ".caf") AudioServicesCreateSystemSoundID(fileURL as CFURL, &soundID) - logger.log("\(sound, privacy: .public) \(soundID)") + logger.trace("\(sound, privacy: .public) \(soundID)") } if number == 0 || number > 9 || playSoundsI < 0 { AudioServicesPlaySystemSound(soundID);