Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. iOS
  3. XCGLogger

XCGLogger

MITSwift

A debug log framework for Swift that adds context like date, function, filename, and line number to console and file logs.

GitHubGitHub
4.0k stars476 forks0 contributors

What is XCGLogger?

XCGLogger is a debug log framework for Swift projects that enhances basic logging with contextual information like timestamps, function names, filenames, and line numbers. It solves the problem of Swift lacking a C preprocessor, which prevents the use of traditional debug log macros from Objective-C, by providing a feature-rich alternative to `NSLog()` or `print()`.

Target Audience

Swift developers building applications for iOS, macOS, tvOS, or watchOS who need structured, configurable logging for debugging and monitoring.

Value Proposition

Developers choose XCGLogger for its deep integration with Swift, extensive customization options, and performance features like selective execution and background processing, making it a robust and flexible logging solution compared to basic alternatives.

Overview

A debug log framework for use in Swift projects. Allows you to log details to the console (and optionally a file), just like you would have with NSLog() or print(), but with additional information, such as the date, function name, filename and line number.

Use Cases

Best For

  • Adding detailed contextual information to debug logs in Swift apps
  • Logging to multiple destinations like console and files simultaneously
  • Filtering log output by specific files, tags, or developers
  • Improving app performance by avoiding unnecessary log message construction
  • Customizing log formats with colors and custom date styles
  • Managing log files with rotation and archiving in production environments

Not Ideal For

  • Projects targeting Linux or other non-Apple platforms where native support is lacking
  • Teams needing built-in, seamless cloud logging or real-time external log streaming without custom extensions
  • Applications where minimal dependencies and zero-configuration logging for basic debug prints are priorities

Pros & Cons

Pros

Automatic Context Inclusion

Appends date, function name, filename, and line number to every log message, transforming simple prints into detailed debug traces as shown in the example log output.

Efficient Message Building

Uses closures to defer log message construction until necessary, preventing performance waste when logs are suppressed by level, a feature highlighted in the Selective Executing Code section.

Highly Customizable Output

Supports multiple destinations like console and files, custom filters by file or tag, and ANSI color formatting for terminals, allowing fine-grained control over log presentation.

Production-Ready File Management

Includes log rotation by size or time and archiving via AutoRotatingFileDestination, making it suitable for long-running applications in production environments.

Cons

Platform Limitations

Lacks official support for Linux and Objective-C, as noted in the To Do list, restricting use in cross-platform or mixed-language projects.

Clunky Tagging System

The experimental UserInfoHelpers for tagging logs have acknowledged issues, such as cumbersome single-tag usage and problems with set merging, making them unreliable for production.

Complex Advanced Configuration

Setting up custom destinations, filters, and formatters requires significant code and understanding of the advanced usage patterns, which can be daunting for quick implementations.

Frequently Asked Questions

Quick Stats

Stars3,984
Forks476
Contributors0
Open Issues40
Last commit2 years ago
CreatedSince 2014

Tags

#macos-development#ios#file-logging#logging-framework#watchos-development#logging-library#console-logging#debug#tvos#tvos-development#logging#log-management#watchos#ios-development#swift#swift-library#debugging#macos#swift-framework

Built With

S
Swift

Included in

iOS51.7kSwift26.0k
Auto-fetched 18 hours ago

Related Projects

CocoaLumberjackCocoaLumberjack

A fast & simple, yet powerful & flexible logging framework for macOS, iOS, tvOS, watchOS and visionOS

Stars13,328
Forks2,272
Last commit23 days ago
PulsePulse

Network logger for Apple platforms

Stars7,108
Forks372
Last commit1 month ago
SwiftyBeaverSwiftyBeaver

Convenient & secure logging during development & release in Swift 4 & 5

Stars6,058
Forks493
Last commit1 year ago
NSLoggerNSLogger

A modern, flexible logging tool

Stars4,981
Forks566
Last commit1 month ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub