Skip to content

Commit

Permalink
Use serverName as logger label
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-fowler committed Dec 2, 2021
1 parent c9fe942 commit 238f037
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Sources/Hummingbird/Application.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public final class HBApplication: HBExtensible {
configuration: HBApplication.Configuration = HBApplication.Configuration(),
eventLoopGroupProvider: NIOEventLoopGroupProvider = .createNew
) {
var logger = Logger(label: "HummingBird")
var logger = Logger(label: configuration.serverName ?? "HummingBird")
logger.logLevel = configuration.logLevel
self.logger = logger

Expand Down
4 changes: 2 additions & 2 deletions Tests/HummingbirdTests/ApplicationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,15 @@ final class ApplicationTests: XCTestCase {
}

func testServerHeaders() throws {
let app = HBApplication(testing: .embedded, configuration: .init(serverName: "Hummingbird"))
let app = HBApplication(testing: .embedded, configuration: .init(serverName: "TestServer"))
app.router.get("/hello") { _ in
return "Hello"
}
try app.XCTStart()
defer { app.XCTStop() }

app.XCTExecute(uri: "/hello", method: .GET) { response in
XCTAssertEqual(response.headers["server"].first, "Hummingbird")
XCTAssertEqual(response.headers["server"].first, "TestServer")
}
}

Expand Down

0 comments on commit 238f037

Please sign in to comment.