I'm currently writing some swift libraries to be included in an App that uses CocoaLumberjack to log. So initially I've added CocoaLumberjack as a dependency to all of them and it works quite well.
Then I've seen this ticket where they say, that you should not add it as a dependency, but use if it is there.
Despite that I've already seen some projects on GitHub where they do exactly that in Objective-C, I haven't seen it yet in Swift.
Can somebody point me to a sample project or help me to find the right direction to take
THX
Your should add CocoaLumberjack/Swift
as a dependency if your library uses it as a logger.
But your library code should not add any loggers (DDTTYLogger
, DDFileLogger
, etc.) to avoid log duplication.
Adding loggers should be done in final application that uses your library.
For library itself it could be test bundle with tests:
class YourKitTests: XCTestCase {
override func setUp() {
super.setUp()
DDLog.add(DDTTYLogger.sharedInstance(), with: .verbose)
}
}