From 238f037d61f44acea2079b9d577a92f635aec8d6 Mon Sep 17 00:00:00 2001 From: Adam Fowler Date: Thu, 2 Dec 2021 12:55:45 +0000 Subject: [PATCH] Use serverName as logger label --- Sources/Hummingbird/Application.swift | 2 +- Tests/HummingbirdTests/ApplicationTests.swift | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/Hummingbird/Application.swift b/Sources/Hummingbird/Application.swift index f1f34be0..0ecfeeef 100644 --- a/Sources/Hummingbird/Application.swift +++ b/Sources/Hummingbird/Application.swift @@ -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 diff --git a/Tests/HummingbirdTests/ApplicationTests.swift b/Tests/HummingbirdTests/ApplicationTests.swift index b0b78ad8..62b04506 100644 --- a/Tests/HummingbirdTests/ApplicationTests.swift +++ b/Tests/HummingbirdTests/ApplicationTests.swift @@ -69,7 +69,7 @@ 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" } @@ -77,7 +77,7 @@ final class ApplicationTests: XCTestCase { defer { app.XCTStop() } app.XCTExecute(uri: "/hello", method: .GET) { response in - XCTAssertEqual(response.headers["server"].first, "Hummingbird") + XCTAssertEqual(response.headers["server"].first, "TestServer") } }