Files
swift-log/Sources/ExampleUsage/RandomLibrary.swift
T
David Hart 2474d61a80 Multiple proposal improvements to the API (#41)
* Move `Logging.make` to a `Logger` initializer.
* Remove all factory initializers in example and test code.
2019-02-18 20:27:59 +01:00

28 lines
781 B
Swift

//
// THIS IS NOT PART OF THE PITCH, JUST AN EXAMPLE HOW A LOGGER USAGE LOOKS LIKE
//
import Foundation
import Logging
// this is a contrived example of a 3rd party library that is used by the other examples
// this library does not know anything about the systewm that used it, so cannot make
// assumptions about them
class RandomLibrary {
private let logger = Logger(label: "RandomLibrary")
private let queue = DispatchQueue(label: "RandomLibrary")
public init() {}
public func doSomething() {
self.logger.info("doSomething")
}
public func doSomethingAsync(completion: @escaping () -> Void) {
self.queue.asyncAfter(deadline: .now() + 0.1) {
self.logger.info("doSomethingAsync")
completion()
}
}
}