Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions NativeAppTemplate/Logging/Logger.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
// NativeAppTemplate
//

import os

private let appLogger = os.Logger(subsystem: "com.nativeapptemplate", category: "app")

struct Failure {
static func signUp(from source: (some Any).Type, reason: String) -> Self {
.init(source: source, action: "signUp", reason: reason)
Expand Down Expand Up @@ -63,12 +67,12 @@ struct Failure {
private let reason: String

func log() {
print(
[
"source": source,
"action": action,
"reason": reason
]
appLogger.error(
"""
\(self.action, privacy: .public) \
source=\(self.source, privacy: .public) \
reason=\(self.reason, privacy: .private)
"""
)
}
}
Expand All @@ -95,6 +99,6 @@ struct Event {
private let action: String

func log() {
print("EVENT:: \(["source": source, "action": action])")
appLogger.info("EVENT:: source: \(self.source, privacy: .public), action: \(self.action, privacy: .public)")
}
}
4 changes: 4 additions & 0 deletions NativeAppTemplate/Login/LoginRepository.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ import Foundation
let loggedInShopkeeper = try keychainStore.retrieve()
_currentShopkeeper = Shopkeeper(from: loggedInShopkeeper)
} catch {
#if DEBUG
print(error)
#endif
}
}
return _currentShopkeeper
Expand Down Expand Up @@ -86,7 +88,9 @@ import Foundation
do {
try keychainStore.remove()
} catch {
#if DEBUG
print(error)
#endif
}
}
}
2 changes: 2 additions & 0 deletions NativeAppTemplate/Login/SignUpRepository.swift
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ import Foundation
do {
try keychainStore.remove()
} catch {
#if DEBUG
print(error)
#endif
}
}
}
4 changes: 4 additions & 0 deletions NativeAppTemplate/NFCManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,9 @@ extension NFCManager: NFCNDEFReaderSessionDelegate {
isLock: isLock
) { error in
guard error == nil else { return }
#if DEBUG
print(">>> Write: \(userNdefMessage)")
#endif
}
}

Expand Down Expand Up @@ -263,6 +265,8 @@ extension NFCManager: NFCNDEFReaderSessionDelegate {
func readerSessionDidBecomeActive(_ session: NFCNDEFReaderSession) {}

func readerSession(_ session: NFCNDEFReaderSession, didInvalidateWithError error: Error) {
#if DEBUG
print("readerSession error: \(error.localizedDescription)")
#endif
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ extension KeychainStore {

func store(_ data: DataType) throws {
let archived: Data
#if DEBUG
print("data: \(data)")
#endif
do {
archived = try NSKeyedArchiver.archivedData(withRootObject: data, requiringSecureCoding: true)
} catch {
Expand Down
4 changes: 4 additions & 0 deletions NativeAppTemplate/Utilities/Utility.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,16 @@ enum Utility {
if let itemTagId = item.value {
itemTagInfo.id = itemTagId
}
#if DEBUG
print("item_tag_id: \(String(describing: itemTagInfo.id))")
#endif
case "type":
if let type = item.value {
itemTagInfo.type = type
}
#if DEBUG
print("type: \(String(describing: itemTagInfo.type))")
#endif
default:
break
}
Expand Down
Loading