Logging for Swift: SwiftyBeaver Library

Online Python Trainer for Beginners

Learn Python easily without overwhelming theory. Solve practical tasks with automatic checking, get hints in Russian, and write code directly in your browser — no installation required.

Start Course

What is SwiftyBeaver and why is it needed?

SwiftyBeaver is a powerful and flexible logging library for Swift applications (iOS, macOS, tvOS, watchOS). Unlike the standard print(), which is unstructured and inconvenient for analysis, SwiftyBeaver provides colored console output, file logging, cloud synchronization, and integration with popular analytics services. The main goal is to make application debugging and monitoring as transparent and efficient as possible.

How to install

Installation via Swift Package Manager (SPM) is the simplest way:

  1. In Xcode, select File → Add Packages.
  2. Enter the URL: https://github.com/SwiftyBeaver/SwiftyBeaver.git.
  3. Select the version (latest stable is recommended).
  4. Add the package to your target.

Installation via CocoaPods or Carthage is also available.

Main features

  • Colored console output — different logging levels (debug, info, warning, error) are highlighted with color for quick visual filtering.
  • File logging — automatic saving of logs on the device with rotation by size/date.
  • Cloud logging — sending logs to the SwiftyBeaver Cloud server for remote monitoring.
  • Formatting — customization of date, time, file name, code line.
  • Filtering — enabling/disabling logs by minimum level or by module name.

Swift code example

import SwiftyBeaver

let log = SwiftyBeaver.self

// Configurationlet console = ConsoleDestination() // console outputlet file = FileDestination() // file logging

// Format configurationconsole.format = "$DHH:mm:ss$d $L: $M"file.format = "$DHH:mm:ss$d $L: $M"

// Adding destinationslog.addDestination(console)log.addDestination(file)

// Usagelog.debug("Application launched") // debug messagelog.info("User authorized") // informationallog.warning("Low battery") // warninglog.error("Network error") // error

When to use

SwiftyBeaver is ideal for projects of any size — from small applications to enterprise solutions. It is especially useful for:

  • Debugging complex business processes.
  • Monitoring production versions via the cloud platform.
  • Team development where centralized log storage is needed.
  • Creating custom error reports.

The library is actively maintained, has open source code, and a large community. If you need more than 10,000 log lines per day — consider the paid SwiftyBeaver Cloud plan.

Recommendations