Attempt fix

This commit is contained in:
Christoph Hagen 2023-09-07 15:33:10 +02:00
parent bc104a9040
commit 66a04781d3
2 changed files with 9 additions and 4 deletions

View File

@ -23,8 +23,6 @@ private let dateFormatter: DateFormatter = {
public func configure(_ app: Application) async throws {
let storageFolder = URL(fileURLWithPath: app.directory.resourcesDirectory)
let logFolder = storageFolder.appendingPathComponent("logs")
try migrate(folder: logFolder)
fatalError("Done")
let monitor = MetricObserver(logFileFolder: logFolder, logMetricId: "sesame.log")
MetricObserver.standard = monitor
@ -91,7 +89,7 @@ func log(_ message: String) {
import CBORCoding
private func migrate(folder: URL) throws {
public func migrate(folder: URL) throws {
try migrateMetric("sesame.log", containing: String.self, in: folder)
try migrateMetric("sesame.status", containing: ServerStatus.self, in: folder)
try migrateMetric("sesame.connected", containing: Bool.self, in: folder)

View File

@ -6,6 +6,12 @@ try LoggingSystem.bootstrap(from: &env)
let app = Application(env)
defer { app.shutdown() }
let storageFolder = URL(fileURLWithPath: app.directory.resourcesDirectory)
let logFolder = storageFolder.appendingPathComponent("logs")
print("Starting migration")
try migrate(folder: logFolder)
print("Finished migration")
/*
private let semaphore = DispatchSemaphore(value: 0)
Task {
try await configure(app)
@ -13,3 +19,4 @@ Task {
}
semaphore.wait()
try app.run()
*/