Convert remain NSLog statement to new logging framework

This commit is contained in:
ronaldheft
2022-09-13 21:16:55 -04:00
parent f8836be147
commit 7a68cc99af
9 changed files with 95 additions and 80 deletions
+8 -6
View File
@@ -28,6 +28,8 @@ extension String {
@objc(AbsDatabase)
public class AbsDatabase: CAPPlugin {
private let logger = AppLogger(category: "AbsDatabase")
@objc func setCurrentServerConnectionConfig(_ call: CAPPluginCall) {
var id = call.getString("id")
let address = call.getString("address", "")
@@ -82,7 +84,7 @@ public class AbsDatabase: CAPPlugin {
let items = Database.shared.getLocalLibraryItems()
call.resolve([ "value": try items.asDictionaryArray()])
} catch(let exception) {
NSLog("error while readling local library items")
logger.error("error while readling local library items")
debugPrint(exception)
call.resolve()
}
@@ -98,7 +100,7 @@ public class AbsDatabase: CAPPlugin {
call.resolve()
}
} catch(let exception) {
NSLog("error while readling local library items")
logger.error("error while readling local library items")
debugPrint(exception)
call.resolve()
}
@@ -114,7 +116,7 @@ public class AbsDatabase: CAPPlugin {
call.resolve()
}
} catch(let exception) {
NSLog("error while readling local library items")
logger.error("error while readling local library items")
debugPrint(exception)
call.resolve()
}
@@ -128,7 +130,7 @@ public class AbsDatabase: CAPPlugin {
do {
call.resolve([ "value": try Database.shared.getAllLocalMediaProgress().asDictionaryArray() ])
} catch {
NSLog("Error while loading local media progress")
logger.error("Error while loading local media progress")
debugPrint(error)
call.resolve(["value": []])
}
@@ -178,7 +180,7 @@ public class AbsDatabase: CAPPlugin {
return
}
NSLog("syncServerMediaProgressWithLocalMediaProgress: Saving local media progress")
logger.log("syncServerMediaProgressWithLocalMediaProgress: Saving local media progress")
try localMediaProgress.updateFromServerMediaProgress(serverMediaProgress)
call.resolve(try localMediaProgress.asDictionary())
@@ -194,7 +196,7 @@ public class AbsDatabase: CAPPlugin {
let localMediaProgressId = call.getString("localMediaProgressId")
let isFinished = call.getBool("isFinished", false)
NSLog("updateLocalMediaProgressFinished \(localMediaProgressId ?? "Unknown") | Is Finished: \(isFinished)")
logger.log("updateLocalMediaProgressFinished \(localMediaProgressId ?? "Unknown") | Is Finished: \(isFinished)")
do {
let localMediaProgress = try LocalMediaProgress.fetchOrCreateLocalMediaProgress(localMediaProgressId: localMediaProgressId, localLibraryItemId: localLibraryItemId, localEpisodeId: localEpisodeId)