commit 95c1c61675743c30f7d1def64cf7f103108f523e
parent be6a33511c211977bb9395161f041ad4063ebb8c
Author: Marc Stibane <marc@taler.net>
Date: Thu, 23 Nov 2023 17:19:37 +0100
Logging
Diffstat:
2 files changed, 14 insertions(+), 16 deletions(-)
diff --git a/TalerWallet1/Backend/WalletCore.swift b/TalerWallet1/Backend/WalletCore.swift
@@ -153,7 +153,7 @@ extension WalletCore {
userInfo: [AnyHashable: Any]? = nil) {
Task { // runs on MainActor
await postNotificationM(aName, object: anObject, userInfo: userInfo)
- logger.log("Notification sent: \(aName.rawValue)")
+ logger.info("Notification sent: \(aName.rawValue)")
}
}
@@ -200,7 +200,7 @@ extension WalletCore {
postNotification(.TransactionDone, userInfo: [TRANSACTIONTRANSITION: decoded])
return
case .expired:
- logger.log("Expired: \(decoded.transactionId, privacy: .private(mask: .hash))")
+ logger.warning("Expired: \(decoded.transactionId, privacy: .private(mask: .hash))")
Controller.shared.playSound(0)
postNotification(.TransactionExpired, userInfo: [TRANSACTIONTRANSITION: decoded])
return
@@ -224,7 +224,7 @@ extension WalletCore {
logger.log("Pending: \(decoded.transactionId, privacy: .private(mask: .hash))")
postNotification(.TransactionStateTransition, userInfo: [TRANSACTIONTRANSITION: decoded])
default:
- logger.log("Yikes: \(decoded.transactionId, privacy: .private(mask: .hash))")
+ logger.warning("Unknow transition: \(decoded.transactionId, privacy: .private(mask: .hash))")
postNotification(.TransactionStateTransition, userInfo: [TRANSACTIONTRANSITION: decoded])
} // switch
} // type
diff --git a/TalerWallet1/Controllers/DebugViewC.swift b/TalerWallet1/Controllers/DebugViewC.swift
@@ -170,31 +170,29 @@ class DebugViewC: ObservableObject {
logger.log("\(newID, privacy: .public) stays")
// don't set viewID to the same value, it would just trigger an unneccessary redraw
}
- } else if viewID > 0 {
- logger.log("switching OFF, will not use \(newID, privacy: .public)")
- viewID = 0 // publish OFF
} else {
- logger.log("off, will not use \(newID, privacy: .public)")
- // don't set viewID from 0 to 0 again, it would just trigger an unneccessary redraw
+ logger.log("view \(newID, privacy: .public)")
+ if viewID > 0 {
+ viewID = 0 // publish OFF
+ }
}
}
@MainActor func setSheetID(_ newID: Int) -> Void {
if developerMode {
if sheetID != newID {
- logger.log("switching from \(self.sheetID, privacy: .public) to \(newID, privacy: .public) for sheet")
+ logger.log("sheet switching from \(self.sheetID, privacy: .public) to \(newID, privacy: .public)")
sheetID = newID // publish new sheetID
} else {
- logger.log("\(newID, privacy: .public) stays for sheet")
+ logger.log("sheet \(newID, privacy: .public) stays")
// don't set sheetID to the same value, it would just trigger an unneccessary redraw
}
- } else if sheetID > 0 {
- // might happen after switching DevMode off, if sheetID still has the old value of the last sheet
- logger.log("switching OFF, will not use \(newID, privacy: .public) for sheet")
- sheetID = 0 // publish OFF
} else {
- logger.log("off, will not use \(newID, privacy: .public) for sheet")
- // don't set sheetID from 0 to 0 again, it would just trigger an unneccessary redraw
+ logger.log("sheet \(newID, privacy: .public)")
+ if sheetID > 0 {
+ // might happen after switching DevMode off, if sheetID still has the old value of the last sheet
+ sheetID = 0 // publish OFF
+ }
}
}
}