From 2f0827a43010810346062d66a5f0f1a10fa0cb6b Mon Sep 17 00:00:00 2001 From: Christoph Hagen Date: Mon, 5 Sep 2022 19:27:31 +0200 Subject: [PATCH] Configure file log --- Sources/App/configure.swift | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Sources/App/configure.swift b/Sources/App/configure.swift index be848c4..6972954 100644 --- a/Sources/App/configure.swift +++ b/Sources/App/configure.swift @@ -10,8 +10,6 @@ public func configure(_ app: Application) throws { let resourcesFolderUrl = URL(fileURLWithPath: app.directory.resourcesDirectory) let configUrl = resourcesFolderUrl.appendingPathComponent("config.json") - tokenStorage = .init(in: resourcesFolderUrl) - let config: ServerConfiguration do { let data = try Data(contentsOf: configUrl) @@ -20,6 +18,9 @@ public func configure(_ app: Application) throws { print("Failed to load config from \(configUrl.path): \(error)") return } + Log.set(logFile: URL(fileURLWithPath: config.logPath)) + + tokenStorage = .init(in: resourcesFolderUrl) app.http.server.configuration.port = config.port @@ -35,6 +36,7 @@ public func configure(_ app: Application) throws { try routes(app) serverStatus = .running + log(info: "Server is running") } private extension JSONDecoder {