diff --git a/Tests/LoggingLokiTests/LokiLogProcessorConfigurationTests.swift b/Tests/LoggingLokiTests/LokiLogProcessorConfigurationTests.swift index f7b9f6c..55ebf3c 100644 --- a/Tests/LoggingLokiTests/LokiLogProcessorConfigurationTests.swift +++ b/Tests/LoggingLokiTests/LokiLogProcessorConfigurationTests.swift @@ -9,7 +9,7 @@ final class LokiLogProcessorConfigurationTests: XCTestCase { XCTAssertEqual(configuration1._lokiURL, "http://localhost:3200/loki/api/v1/push") configuration1.lokiURL = "http://localhost:3300" XCTAssertEqual(configuration1._lokiURL, "http://localhost:3300/loki/api/v1/push") - var configuration2 = LokiLogProcessorConfiguration(lokiURL: "http://localhost:3100/") + let configuration2 = LokiLogProcessorConfiguration(lokiURL: "http://localhost:3100/") XCTAssertEqual(configuration2._lokiURL, "http://localhost:3100/loki/api/v1/push") } } diff --git a/Tests/LoggingLokiTests/LokiLogProcessorTests.swift b/Tests/LoggingLokiTests/LokiLogProcessorTests.swift index d927696..118040b 100644 --- a/Tests/LoggingLokiTests/LokiLogProcessorTests.swift +++ b/Tests/LoggingLokiTests/LokiLogProcessorTests.swift @@ -26,7 +26,7 @@ final class LokiLogProcessorTests: XCTestCase { let configuration = LokiLogProcessorConfiguration( lokiURL: "http://localhost:3100", metadataFormat: .custom({ level, message, metadata in - "\(level.rawValue.uppercased()): \(message) \(metadata)" + "\(level.rawValue.uppercased()): \(message) [\(metadata.sorted(by: { $0.key < $1.key }).map({ "\($0.key): \($0.value)" }).joined(separator: ", "))]" }) ) let processor = LokiLogProcessor(configuration: configuration) @@ -38,6 +38,6 @@ final class LokiLogProcessorTests: XCTestCase { ) let formatted = processor.makeLog(raw) XCTAssertNil(formatted.metadata) - XCTAssertEqual(formatted.line, #"INFO: My log message ["basic_key": basic_value, "additional_key": value with whitespace]"#) + XCTAssertEqual(formatted.line, #"INFO: My log message [additional_key: value with whitespace, basic_key: basic_value]"#) } }