Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 64cc15e

Browse files
authored
Make tests respect the LOG_LEVEL env var (vapor#188)
1 parent e43a32b commit 64cc15e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Tests/PostgresKitTests/PostgresKitTests.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,10 +197,14 @@ enum Bar: Int, Codable {
197197
}
198198
extension Bar: PostgresDataConvertible { }
199199

200+
func env(_ name: String) -> String? {
201+
getenv(name).flatMap { String(cString: $0) }
202+
}
203+
200204
let isLoggingConfigured: Bool = {
201205
LoggingSystem.bootstrap { label in
202206
var handler = StreamLogHandler.standardOutput(label: label)
203-
handler.logLevel = .debug
207+
handler.logLevel = env("LOG_LEVEL").flatMap { Logger.Level(rawValue: $0) } ?? .debug
204208
return handler
205209
}
206210
return true

0 commit comments

Comments
 (0)