CocoaLumberjack is a fast, configurable logging framework for macOS, iOS, tvOS, watchOS, and visionOS apps. It integrates via Swift Package Manager, CocoaPods, or Carthage with console and file loggers.
Overview
CocoaLumberjack provides application logging for Apple's platforms with Objective-C and Swift APIs. Teams add loggers such as DDOSLogger on recent iOS versions or DDTTYLogger and DDASLLogger on older releases, then emit messages through DDLog macros that mirror NSLog syntax.
A single statement can fan out to multiple loggers simultaneously—for example console and rolling file output. DDFileLogger supports rotation intervals and retained file counts. Configuration can vary log levels per file, per logger, per build configuration, or at runtime, and statements can strip from release builds.
The framework emphasizes performance on multi-threaded apps using Grand Central Dispatch, lockless atomics, and runtime features tuned for Objective-C. Custom formatters and additional logger destinations extend output to networks, databases, or other sinks. A swift-log backend product forwards Logger calls into DDLog while preserving formatter hooks via DDLogMessage metadata.
Distribution uses Swift Package Manager, CocoaPods, Carthage, or manual integration with separate Swift and Objective-C import paths. Documentation covers migration, colored Xcode console output, benchmarks, and common integration pitfalls such as legacy message tag conflicts.
Key features
- Multi-logger fan-out architecture
- DDLog macros matching NSLog syntax
- Rolling file logger with retention
- Per-file and per-build log levels
- Custom formatters and loggers
- swift-log DDLogHandler backend
- SPM, CocoaPods, and Carthage install
- GCD-oriented performant logging
Use cases
- Structured iOS and macOS app logs
- Debug versus release verbosity control
- Persistent rolling diagnostic files
- Bridging swift-log into native loggers
- Field bug diagnosis beyond console limits