Swiftpack.co -  saltzmanjoelh/log-kit as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
Just a few things to help out with logging.
.package(url: "https://github.com/saltzmanjoelh/log-kit.git", from: "1.0.0")


Swift 5.1 Codecov Result

Just a few things to help out with logging.


When it's told to log, it will send it to the output as well as collect it in the logs collection. You pass it a LogCollector on initialization. The LogCollector will store the logs so you need to keep a reference it to.

let collector = LogCollector()
CollectingLogger(label: "Example", logCollector: collector)

Now when you want to programtically check for logs, you can use the LogHandler's filter functions or directly access the entries through the allEntries property.

let collector = LogCollector()
var logger = CollectingLogger(label: "Example", logCollector: collector)
let value = UUID().uuidString

// Then the entries will contain a message with the value
let entry = collector.logs.filter { entry in

Log Message Flow


In the setup function of your tests, use this to add the test name to the logs. It will change the logs of Logger.myCustomLogger.debug("!!! Logging debug details") from looking like this:

debug com.apple.dt.xctest.tool : !!! Logging debug details

into this:

debug com.apple.dt.xctest.tool : test=LogKitTests.testExample !!! Logging debug details

Here is how to use it

override func setUp() {
    self.logger = Logger(label: "Example")


Stars: 1
Last commit: 1 week ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Submit a free job ad (while I'm testing this). The analytics numbers for this website are here.


Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics