diff --git a/Package.swift b/Package.swift index c58f0c96..8264d710 100644 --- a/Package.swift +++ b/Package.swift @@ -10,7 +10,7 @@ let package = Package( .library(name: "Fluent", targets: ["Fluent"]), ], dependencies: [ - .package(url: "https://github.com/vapor/fluent-kit.git", from: "1.36.0"), + .package(url: "https://github.com/vapor/fluent-kit.git", from: "1.38.0"), .package(url: "https://github.com/vapor/vapor.git", from: "4.50.0"), ], targets: [ diff --git a/Sources/Fluent/FluentProvider.swift b/Sources/Fluent/FluentProvider.swift index 69125da2..47aa47dc 100644 --- a/Sources/Fluent/FluentProvider.swift +++ b/Sources/Fluent/FluentProvider.swift @@ -52,7 +52,8 @@ extension Application { databases: self.databases, migrations: self.migrations, logger: self.logger, - on: self.eventLoopGroup.next() + on: self.eventLoopGroup.any(), + migrationLogLevel: self.fluent.migrationLogLevel ) } @@ -76,13 +77,15 @@ extension Application { final class Storage { let databases: Databases let migrations: Migrations + var migrationLogLevel: Logger.Level - init(threadPool: NIOThreadPool, on eventLoopGroup: EventLoopGroup) { + init(threadPool: NIOThreadPool, on eventLoopGroup: EventLoopGroup, migrationLogLevel: Logger.Level) { self.databases = Databases( threadPool: threadPool, on: eventLoopGroup ) self.migrations = .init() + self.migrationLogLevel = migrationLogLevel } } @@ -128,11 +131,17 @@ extension Application { func initialize() { self.application.storage[Key.self] = .init( threadPool: self.application.threadPool, - on: self.application.eventLoopGroup + on: self.application.eventLoopGroup, + migrationLogLevel: .info ) self.application.lifecycle.use(Lifecycle()) self.application.commands.use(MigrateCommand(), as: "migrate") } + + public var migrationLogLevel: Logger.Level { + get { self.storage.migrationLogLevel } + nonmutating set { self.storage.migrationLogLevel = newValue } + } public var history: History { .init(fluent: self)