File tree Expand file tree Collapse file tree
Persistence/KeychainStore Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55
66import os
77
8- private let appLogger = os. Logger ( subsystem: " com.nativeapptemplate " , category: " app " )
8+ let appLogger = os. Logger ( subsystem: " com.nativeapptemplate " , category: " app " )
99
1010struct Failure {
1111 static func signUp( from source: ( some Any ) . Type, reason: String ) -> Self {
Original file line number Diff line number Diff line change 44//
55
66import Foundation
7+ import os
78
89@MainActor @Observable public class LoginRepository : LoginRepositoryProtocol {
910 // MARK: - Properties
@@ -18,9 +19,7 @@ import Foundation
1819 let loggedInShopkeeper = try keychainStore. retrieve ( )
1920 _currentShopkeeper = Shopkeeper ( from: loggedInShopkeeper)
2021 } catch {
21- #if DEBUG
22- print ( error)
23- #endif
22+ appLogger. debug ( " LoginRepository retrieve error: \( error, privacy: . private) " )
2423 }
2524 }
2625 return _currentShopkeeper
@@ -88,9 +87,7 @@ import Foundation
8887 do {
8988 try keychainStore. remove ( )
9089 } catch {
91- #if DEBUG
92- print ( error)
93- #endif
90+ appLogger. debug ( " LoginRepository remove error: \( error, privacy: . private) " )
9491 }
9592 }
9693}
Original file line number Diff line number Diff line change 44//
55
66import Foundation
7+ import os
78
89@MainActor class SignUpRepository : SignUpRepositoryProtocol {
910 func signUp( signUp: SignUp ) async throws -> Shopkeeper {
@@ -100,9 +101,7 @@ import Foundation
100101 do {
101102 try keychainStore. remove ( )
102103 } catch {
103- #if DEBUG
104- print ( error)
105- #endif
104+ appLogger. debug ( " SignUpRepository remove error: \( error, privacy: . private) " )
106105 }
107106 }
108107}
Original file line number Diff line number Diff line change 55
66@preconcurrency import CoreNFC
77import Foundation
8+ import os
89
910protocol NFCManagerProtocol : Sendable {
1011 @MainActor var scanResult : Result < ItemTagData , Error > ? { get }
@@ -205,9 +206,7 @@ extension NFCManager: NFCNDEFReaderSessionDelegate {
205206 isLock: isLock
206207 ) { error in
207208 guard error == nil else { return }
208- #if DEBUG
209- print ( " >>> Write: \( userNdefMessage) " )
210- #endif
209+ appLogger. debug ( " NFC Write: \( userNdefMessage, privacy: . private) " )
211210 }
212211 }
213212
@@ -265,8 +264,6 @@ extension NFCManager: NFCNDEFReaderSessionDelegate {
265264 func readerSessionDidBecomeActive( _ session: NFCNDEFReaderSession ) { }
266265
267266 func readerSession( _ session: NFCNDEFReaderSession , didInvalidateWithError error: Error ) {
268- #if DEBUG
269- print ( " readerSession error: \( error. localizedDescription) " )
270- #endif
267+ appLogger. debug ( " readerSession error: \( error. localizedDescription, privacy: . private) " )
271268 }
272269}
Original file line number Diff line number Diff line change 55
66import Foundation
77import KeychainAccess
8+ import os
89
910enum KeychainStoreError : Error {
1011 case secCallFailed( Error )
@@ -60,9 +61,7 @@ extension KeychainStore {
6061
6162 func store( _ data: DataType ) throws {
6263 let archived : Data
63- #if DEBUG
64- print ( " data: \( data) " )
65- #endif
64+ appLogger. debug ( " KeychainStore data: \( data, privacy: . private) " )
6665 do {
6766 archived = try NSKeyedArchiver . archivedData ( withRootObject: data, requiringSecureCoding: true )
6867 } catch {
Original file line number Diff line number Diff line change 55
66import CoreNFC
77import Foundation
8+ import os
89
910enum Utility {
1011 static func scanUrl( itemTagId: String , itemTagType: String ) -> URL {
@@ -75,16 +76,12 @@ enum Utility {
7576 if let itemTagId = item. value {
7677 itemTagInfo. id = itemTagId
7778 }
78- #if DEBUG
79- print ( " item_tag_id: \( String ( describing: itemTagInfo. id) ) " )
80- #endif
79+ appLogger. debug ( " item_tag_id: \( String ( describing: itemTagInfo. id) , privacy: . private) " )
8180 case " type " :
8281 if let type = item. value {
8382 itemTagInfo. type = type
8483 }
85- #if DEBUG
86- print ( " type: \( String ( describing: itemTagInfo. type) ) " )
87- #endif
84+ appLogger. debug ( " type: \( String ( describing: itemTagInfo. type) , privacy: . private) " )
8885 default :
8986 break
9087 }
You can’t perform that action at this time.
0 commit comments