GitPedia

Swift log

A Logging API for Swift

From apple·Updated June 26, 2026·View on GitHub·

This repository contains a logging API implementation for Swift. SwiftLog provides a unified, performant, and ergonomic logging API that can be adopted by libraries and applications across the Swift ecosystem. The project is written primarily in Swift, distributed under the Apache License 2.0 license, first published in 2019. It has gained significant community traction with 4,024 stars and 341 forks on GitHub. Key topics include: logging, swift-server.

Latest release: 1.14.0
June 24, 2026View Changelog →

SwiftLog




This repository contains a logging API implementation for Swift.
SwiftLog provides a unified, performant, and ergonomic logging API that can be
adopted by libraries and applications across the Swift ecosystem.

Quick Start

The following snippet shows how to add SwiftLog to your Swift Package:

swift
// swift-tools-version: 6.1 import PackageDescription let package = Package( name: "YourApp", dependencies: [ .package(url: "https://github.com/apple/swift-log", from: "1.6.0") ], targets: [ .target( name: "YourApp", dependencies: [ .product(name: "Logging", package: "swift-log") ] ) ] )

Then start logging:

swift
import Logging // Create a logger let logger = Logger(label: "com.example.YourApp") // Log at different levels logger.info("Application started") logger.warning("This is a warning") logger.error("Something went wrong", metadata: ["error": "\(error)"]) // Add metadata for context var requestLogger = logger requestLogger[metadataKey: "request-id"] = "\(UUID())" requestLogger.info("Processing request")

Available log handler backends

The community has built numerous specialized logging backends.

A great way to discover available log backend implementations is searching the
Swift Package Index
for the swift-log keyword.

Contributors

Showing top 12 contributors by commit count.

View all contributors on GitHub →

This article is auto-generated from apple/swift-log via the GitHub API.Last fetched: 6/28/2026