Skip to content
This repository was archived by the owner on Apr 23, 2021. It is now read-only.

Commit d5c1316

Browse files
committed
added missing withlogger
1 parent 4e766b3 commit d5c1316

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

Sources/BaggageContext/Context.swift

+10
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,16 @@ public struct DefaultContext: Context {
166166
// MARK: `with...` functions
167167

168168
extension DefaultContext {
169+
/// Fluent API allowing for modification of underlying logger when passing the context to other functions.
170+
///
171+
/// - Parameter logger: Logger that should replace the underlying logger of this context.
172+
/// - Returns: new context, with the passed in `logger`
173+
public func withLogger(_ logger: Logger) -> DefaultContext {
174+
var copy = self
175+
copy.logger = logger
176+
return copy
177+
}
178+
169179
/// Fluent API allowing for modification of underlying logger when passing the context to other functions.
170180
///
171181
/// - Parameter logger: Logger that should replace the underlying logger of this context.

Tests/BaggageTests/BaggageTests+XCTest.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ extension BaggageTests {
3131
("testSingleKeyBaggageDescription", testSingleKeyBaggageDescription),
3232
("testMultiKeysBaggageDescription", testMultiKeysBaggageDescription),
3333
("test_todo_context", test_todo_context),
34-
("test_todo_empty", test_todo_empty),
34+
("test_topLevel", test_topLevel),
3535
]
3636
}
3737
}

0 commit comments

Comments
 (0)