Skip to content

Commit

Permalink
-log remove the LoggerWithSource for the time being
Browse files Browse the repository at this point in the history
  • Loading branch information
ktoso committed Jul 6, 2020
1 parent 11a2ec7 commit 8058ed5
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 365 deletions.
293 changes: 0 additions & 293 deletions Sources/Logging/LoggerWithSource.swift

This file was deleted.

8 changes: 1 addition & 7 deletions Sources/Logging/Logging.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ import Glibc
/// and the selected `LogHandler`). Therefore, `Logger`s are suitable to be passed around between libraries if you want
/// to preserve metadata across libraries.
///
/// - seeAlso: `LoggerWithSource` if you'd like to attach a customized source to every log message.
///
/// The most basic usage of a `Logger` is
///
/// logger.info("Hello World!")
Expand Down Expand Up @@ -410,10 +408,6 @@ extension Logger {
public init(label: String, factory: (String) -> LogHandler) {
self = Logger(label: label, factory(label))
}

public func withSource(_ source: String) -> LoggerWithSource {
return LoggerWithSource(self, source: source)
}
}

extension Logger.Level {
Expand Down Expand Up @@ -569,7 +563,7 @@ public struct MultiplexLogHandler: LogHandler {
function: String,
line: UInt) {
for handler in self.handlers where handler.logLevel <= level {
handler.log(level: level, message: message, metadata: metadata, file: file, function: function, line: line)
handler.log(level: level, message: message, metadata: metadata, source: source, file: file, function: function, line: line)
}
}

Expand Down
1 change: 0 additions & 1 deletion Tests/LoggingTests/CompatibilityTest+XCTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import XCTest
extension CompatibilityTest {
static var allTests: [(String, (CompatibilityTest) -> () throws -> Void)] {
return [
("testAllLogLevelsWorkWithOldSchoolLogHandlerButSourceIsNotPropagated", testAllLogLevelsWorkWithOldSchoolLogHandlerButSourceIsNotPropagated),
("testAllLogLevelsWorkWithOldSchoolLogHandlerWorks", testAllLogLevelsWorkWithOldSchoolLogHandlerWorks),
]
}
Expand Down
26 changes: 0 additions & 26 deletions Tests/LoggingTests/CompatibilityTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,32 +16,6 @@
import XCTest

final class CompatibilityTest: XCTestCase {
func testAllLogLevelsWorkWithOldSchoolLogHandlerButSourceIsNotPropagated() {
let testLogging = OldSchoolTestLogging()

var logger = LoggerWithSource(Logger(label: "\(#function)",
factory: testLogging.make),
source: "my-fancy-source")
logger.logLevel = .trace

logger.trace("yes: trace")
logger.debug("yes: debug")
logger.info("yes: info")
logger.notice("yes: notice")
logger.warning("yes: warning")
logger.error("yes: error")
logger.critical("yes: critical")

// Please note that the source is _not_ propagated (because the backend doesn't support it).
testLogging.history.assertExist(level: .trace, message: "yes: trace", source: "no source")
testLogging.history.assertExist(level: .debug, message: "yes: debug", source: "no source")
testLogging.history.assertExist(level: .info, message: "yes: info", source: "no source")
testLogging.history.assertExist(level: .notice, message: "yes: notice", source: "no source")
testLogging.history.assertExist(level: .warning, message: "yes: warning", source: "no source")
testLogging.history.assertExist(level: .error, message: "yes: error", source: "no source")
testLogging.history.assertExist(level: .critical, message: "yes: critical", source: "no source")
}

func testAllLogLevelsWorkWithOldSchoolLogHandlerWorks() {
let testLogging = OldSchoolTestLogging()

Expand Down
2 changes: 0 additions & 2 deletions Tests/LoggingTests/LoggingTest+XCTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ extension LoggingTest {
("testStreamLogHandlerOutputFormatWithMetaData", testStreamLogHandlerOutputFormatWithMetaData),
("testStdioOutputStreamFlush", testStdioOutputStreamFlush),
("testOverloadingError", testOverloadingError),
("testAllLogLevelsWorkOnLoggerWithSource", testAllLogLevelsWorkOnLoggerWithSource),
("testLoggerWithSource", testLoggerWithSource),
]
}
}
Loading

0 comments on commit 8058ed5

Please sign in to comment.