From 4ce68927506bb33d12da33f01ceddbc9c56f8520 Mon Sep 17 00:00:00 2001 From: Laurent Date: Tue, 11 Nov 2025 14:08:25 +0100 Subject: [PATCH] improve log --- LeStorage/Store.swift | 8 ++++++++ LeStorage/StoreCenter.swift | 4 ++++ LeStorage/StoredCollection.swift | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/LeStorage/Store.swift b/LeStorage/Store.swift index c2ad317..f16705f 100644 --- a/LeStorage/Store.swift +++ b/LeStorage/Store.swift @@ -271,6 +271,14 @@ final public class Store { } } + func isRegistered() -> Bool { + if let identifier { + return self.storeCenter.isStoreRegistered(id: identifier) + } else { + return true + } + } + // MARK: - Synchronization fileprivate func _requestWrite(type: T.Type) { diff --git a/LeStorage/StoreCenter.swift b/LeStorage/StoreCenter.swift index bd67435..fd25cc2 100644 --- a/LeStorage/StoreCenter.swift +++ b/LeStorage/StoreCenter.swift @@ -224,6 +224,10 @@ public class StoreCenter { public func destroyStore(identifier: String) { self._storeLibrary.destroyStore(identifier: identifier) } + + func isStoreRegistered(id: String) -> Bool { + return self._storeLibrary[id] != nil + } // MARK: - Settings diff --git a/LeStorage/StoredCollection.swift b/LeStorage/StoredCollection.swift index 3f3c08e..e754a03 100644 --- a/LeStorage/StoredCollection.swift +++ b/LeStorage/StoredCollection.swift @@ -529,7 +529,7 @@ public class StoredCollection: SomeCollection { } catch { Logger.error(error) self.storeCenter.log( - message: "write failed for \(T.resourceName()): \(error.localizedDescription)") + message: "write failed for \(T.resourceName()): \(error.localizedDescription) / store registered \(self.store.isRegistered()), id = \(String(describing: self.store.identifier))") } } self._cleanTimer()