Swiftpack.co -  dreipol/DogSwift as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
Lightweight logging framework written in Swift.
.package(url: "https://github.com/dreipol/DogSwift.git", from: "1.1.2")


A lightweight and easy to use logging API to include in your mobile iOS application.

DogSwift uses os_log on devices with iOS 10.0+ installed and falls back to NSLog for older iOS versions. DogSwift can print errors, messages and object descriptions to Xcode's debugging console. It's also possible to tag each logging statement with a category which will be utilized by Apple's os_log implementation, like UI, Networking et cetera.


Add the environment variable LOG_LEVEL along with the desired value:

  • error = 1
  • warn = 2
  • info = 3
  • debug = 4

Log to Xcode's debugging console

// Log function name of current scope.

// The message parameter can be of type `Any`.
Log.debug(view.bounds, tag: .ui)

// Log a warning.
Log.warn("Current device is running iOS 9.0, which doesn't support os_log.", tag: .location)

// Error logging.
let exampleError = NSError(domain: "ch.dreipol", code: -9999, userInfo: [
    NSLocalizedDescriptionKey: "Flying to the moon was not possible.",
    NSLocalizedFailureReasonErrorKey: "The operation timed out.",
    NSLocalizedRecoverySuggestionErrorKey: "Have you tried turning it off and on again?"
Log.error(exampleError, description: #function, tag: .system

Logging with tags

Tags can help to group the logging output. Currently the folliwing tags are supported:

  • none
  • database
  • networking
  • system
  • ui

Define custom tags

It's possible to define your own tags and pass them to DogSwift:

import DogSwift

enum ExampleTag: String {
    case viewDidLoad

extension ExampleTag: TagProtocol {
    func makeString() -> String {
        return String(describing: self)

The new Tag can now be passed to DogSwift:


override func viewDidLoad() {

    Log.debug(view.bounds, tag: ExampleTag.viewDidLoad)


Swift 5.0

Installation with CocoaPods

DogSwift is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'DogSwift'

Installation using Swift Package Manager

Add the following to your Package.swift file:

dependencies: [
    .package(url: "https://github.com/dreipol/DogSwift.git", .upToNextMajor(from: "1.1.2"))


To run the example project, open DogSwiftExample.xcworkspace which resides inside the DogSwiftExample directory. The demo app contains some examples on how to use DogSwift for Logging errors as well as various information to Xcode's debugging console.


Stars: 4
Last commit: 3 days 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.

Release Notes

3 days ago

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