diff --git a/Modules/AccountKit/Sources/Database/DatabaseOperations.swift b/Modules/AccountKit/Sources/Database/DatabaseOperations.swift index d01d112a27..ea6b81e5f4 100644 --- a/Modules/AccountKit/Sources/Database/DatabaseOperations.swift +++ b/Modules/AccountKit/Sources/Database/DatabaseOperations.swift @@ -27,10 +27,12 @@ public class DatabaseOperations { if let error { promise(.failure(DatabaseError.customError(error.localizedDescription))) } else { + log.info("Document \(String(describing: documentData.id)) created successfully. 🎉") promise(.success(documentData)) } } } catch { + log.error("\(error.localizedDescription)") promise(.failure(error)) } } @@ -47,11 +49,13 @@ public class DatabaseOperations { do { let object = try document?.data(as: T.self) if let object { + log.info("Document \(String(describing: object.id)) fetched successfully. 🎉") promise(.success(object)) } else { promise(.failure(DatabaseError.documentNotFound)) } } catch { + log.error("\(error.localizedDescription)") promise(.failure(error)) } } @@ -65,11 +69,13 @@ public class DatabaseOperations { self.database.collection(collection.rawValue) .getDocuments { querySnapshot, error in if let error { + log.error("\(error.localizedDescription)") promise(.failure(error)) } else { let objects = querySnapshot?.documents.compactMap { document -> T? in try? document.data(as: T.self) } ?? [] + log.info("\(String(describing: objects.count)) documents fetched successfully. 🎉") promise(.success(objects)) } }