Use Logger materialisedFileHandling for logging in FileProviderMaterialisedEnumerationObserver

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
Claudio Cambra 2023-03-14 21:07:16 +01:00
parent 5c72c6a2e9
commit 854b11e477
No known key found for this signature in database
GPG key ID: C839200C384636B0

View file

@ -14,6 +14,7 @@
import Foundation import Foundation
import FileProvider import FileProvider
import OSLog
class FileProviderMaterialisedEnumerationObserver : NSObject, NSFileProviderEnumerationObserver { class FileProviderMaterialisedEnumerationObserver : NSObject, NSFileProviderEnumerationObserver {
let ncKitAccount: String let ncKitAccount: String
@ -35,14 +36,14 @@ class FileProviderMaterialisedEnumerationObserver : NSObject, NSFileProviderEnum
} }
func finishEnumerating(upTo nextPage: NSFileProviderPage?) { func finishEnumerating(upTo nextPage: NSFileProviderPage?) {
NSLog("Handling enumerated materialised items.") Logger.materialisedFileHandling.debug("Handling enumerated materialised items.")
FileProviderMaterialisedEnumerationObserver.handleEnumeratedItems(self.allEnumeratedItemIds, FileProviderMaterialisedEnumerationObserver.handleEnumeratedItems(self.allEnumeratedItemIds,
account: self.ncKitAccount, account: self.ncKitAccount,
completionHandler: self.completionHandler) completionHandler: self.completionHandler)
} }
func finishEnumeratingWithError(_ error: Error) { func finishEnumeratingWithError(_ error: Error) {
NSLog("Ran into error when enumerating materialised items. Handling items enumerated so far") Logger.materialisedFileHandling.error("Ran into error when enumerating materialised items: \(error). Handling items enumerated so far")
FileProviderMaterialisedEnumerationObserver.handleEnumeratedItems(self.allEnumeratedItemIds, FileProviderMaterialisedEnumerationObserver.handleEnumeratedItems(self.allEnumeratedItemIds,
account: self.ncKitAccount, account: self.ncKitAccount,
completionHandler: self.completionHandler) completionHandler: self.completionHandler)
@ -64,7 +65,7 @@ class FileProviderMaterialisedEnumerationObserver : NSObject, NSFileProviderEnum
} }
DispatchQueue.main.async { DispatchQueue.main.async {
NSLog("Cleaning up local file metadatas for unmaterialised items") Logger.materialisedFileHandling.info("Cleaning up local file metadatas for unmaterialised items")
for itemId in noLongerMaterialisedIds { for itemId in noLongerMaterialisedIds {
dbManager.deleteLocalFileMetadata(ocId: itemId) dbManager.deleteLocalFileMetadata(ocId: itemId)
} }