diff --git a/Sources/App/CapServer.swift b/Sources/App/CapServer.swift index 98b8561..f413b84 100644 --- a/Sources/App/CapServer.swift +++ b/Sources/App/CapServer.swift @@ -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)") } }