From 3ec7217504cd52edc03cbf2e0190361a55a54310 Mon Sep 17 00:00:00 2001 From: Christoph Hagen Date: Fri, 24 Jun 2022 11:49:34 +0200 Subject: [PATCH] Add more logging --- Sources/App/CapServer.swift | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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)") } }