Add more logging

This commit is contained in:
Christoph Hagen 2022-06-24 11:49:34 +02:00
parent 23859d9d68
commit 3ec7217504

View File

@ -24,7 +24,11 @@ final class CapServer {
get {
do {
let content = try String(contentsOf: classifierVersionFile)
return Int(content) ?? 0
guard let value = Int(content) else {
log("Invalid classifier version: \(content)")
return 0
}
return value
} catch {
log("Failed to read classifier version file: \(error)")
return 0
@ -249,6 +253,7 @@ final class CapServer {
caps[cap]?.classifierVersion = version
}
}
log("Updated \(trainedCaps.count) classifier classes")
}
func save(classifier: Data, version: Int) throws {
@ -259,5 +264,6 @@ final class CapServer {
throw Abort(.internalServerError)
}
classifierVersion = version
log("Updated classifier to version \(version)")
}
}