Skip to content

Commit 8058ed5

Browse files
committed
-log remove the LoggerWithSource for the time being
1 parent 11a2ec7 commit 8058ed5

File tree

6 files changed

+1
-365
lines changed

6 files changed

+1
-365
lines changed

Sources/Logging/LoggerWithSource.swift

Lines changed: 0 additions & 293 deletions
This file was deleted.

Sources/Logging/Logging.swift

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ import Glibc
2727
/// and the selected `LogHandler`). Therefore, `Logger`s are suitable to be passed around between libraries if you want
2828
/// to preserve metadata across libraries.
2929
///
30-
/// - seeAlso: `LoggerWithSource` if you'd like to attach a customized source to every log message.
31-
///
3230
/// The most basic usage of a `Logger` is
3331
///
3432
/// logger.info("Hello World!")
@@ -410,10 +408,6 @@ extension Logger {
410408
public init(label: String, factory: (String) -> LogHandler) {
411409
self = Logger(label: label, factory(label))
412410
}
413-
414-
public func withSource(_ source: String) -> LoggerWithSource {
415-
return LoggerWithSource(self, source: source)
416-
}
417411
}
418412

419413
extension Logger.Level {
@@ -569,7 +563,7 @@ public struct MultiplexLogHandler: LogHandler {
569563
function: String,
570564
line: UInt) {
571565
for handler in self.handlers where handler.logLevel <= level {
572-
handler.log(level: level, message: message, metadata: metadata, file: file, function: function, line: line)
566+
handler.log(level: level, message: message, metadata: metadata, source: source, file: file, function: function, line: line)
573567
}
574568
}
575569

Tests/LoggingTests/CompatibilityTest+XCTest.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import XCTest
2525
extension CompatibilityTest {
2626
static var allTests: [(String, (CompatibilityTest) -> () throws -> Void)] {
2727
return [
28-
("testAllLogLevelsWorkWithOldSchoolLogHandlerButSourceIsNotPropagated", testAllLogLevelsWorkWithOldSchoolLogHandlerButSourceIsNotPropagated),
2928
("testAllLogLevelsWorkWithOldSchoolLogHandlerWorks", testAllLogLevelsWorkWithOldSchoolLogHandlerWorks),
3029
]
3130
}

Tests/LoggingTests/CompatibilityTest.swift

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,32 +16,6 @@
1616
import XCTest
1717

1818
final class CompatibilityTest: XCTestCase {
19-
func testAllLogLevelsWorkWithOldSchoolLogHandlerButSourceIsNotPropagated() {
20-
let testLogging = OldSchoolTestLogging()
21-
22-
var logger = LoggerWithSource(Logger(label: "\(#function)",
23-
factory: testLogging.make),
24-
source: "my-fancy-source")
25-
logger.logLevel = .trace
26-
27-
logger.trace("yes: trace")
28-
logger.debug("yes: debug")
29-
logger.info("yes: info")
30-
logger.notice("yes: notice")
31-
logger.warning("yes: warning")
32-
logger.error("yes: error")
33-
logger.critical("yes: critical")
34-
35-
// Please note that the source is _not_ propagated (because the backend doesn't support it).
36-
testLogging.history.assertExist(level: .trace, message: "yes: trace", source: "no source")
37-
testLogging.history.assertExist(level: .debug, message: "yes: debug", source: "no source")
38-
testLogging.history.assertExist(level: .info, message: "yes: info", source: "no source")
39-
testLogging.history.assertExist(level: .notice, message: "yes: notice", source: "no source")
40-
testLogging.history.assertExist(level: .warning, message: "yes: warning", source: "no source")
41-
testLogging.history.assertExist(level: .error, message: "yes: error", source: "no source")
42-
testLogging.history.assertExist(level: .critical, message: "yes: critical", source: "no source")
43-
}
44-
4519
func testAllLogLevelsWorkWithOldSchoolLogHandlerWorks() {
4620
let testLogging = OldSchoolTestLogging()
4721

Tests/LoggingTests/LoggingTest+XCTest.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ extension LoggingTest {
5050
("testStreamLogHandlerOutputFormatWithMetaData", testStreamLogHandlerOutputFormatWithMetaData),
5151
("testStdioOutputStreamFlush", testStdioOutputStreamFlush),
5252
("testOverloadingError", testOverloadingError),
53-
("testAllLogLevelsWorkOnLoggerWithSource", testAllLogLevelsWorkOnLoggerWithSource),
54-
("testLoggerWithSource", testLoggerWithSource),
5553
]
5654
}
5755
}

0 commit comments

Comments
 (0)