SwiftLog is the open-source logging API for Swift, published by Apple under the Apache 2.0 licence, that gives libraries and applications across the Swift ecosystem a single unified, performant and ergonomic logging interface to code against.
What it is
SwiftLog is an API package rather than a logging implementation. It defines the surface that Swift code calls: the Logger type, initialised with a label, levels such as info, warning and error, and structured metadata attached per message or per logger instance. The package itself ships as the Logging product, imported with import Logging, and is delivered through Swift Package Manager using the declaration .package(url: "https://github.com/apple/swift-log", from: "1.6.0"). It lives in the swift-server ecosystem alongside the rest of the Swift server work, and documentation and tutorials are hosted on the Swift Package Index.
The concrete problem it solves is fragmentation of the logging surface. When every library carries its own logging abstraction and every application wires up its own output, consumers inherit mismatched interfaces and duplicate configuration. SwiftLog replaces that by being the one API a library depends on and a application calls, while the actual emission of log records is delegated to a handler. The README is explicit that SwiftLog is an API package: production use requires choosing from the many community-maintained logging backends, which are discoverable on the Swift Package Index by searching for the swift-log keyword.
Key capabilities
- A
Logger(label:) factory producing loggers that emit at distinct levels including info, warning and error.
- Structured metadata, set either per call, as in
logger.error("Something went wrong", metadata: ["error": "\(error)"]), or per logger via subscript, as in requestLogger[metadataKey: "request-id"] = "\(UUID())".
- Direct integration with Swift Package Manager, declaring the package
https://github.com/apple/swift-log from version 1.6.0 and depending on the Logging product; the sample manifest uses // swift-tools-version: 6.1.
- An open backend model: the API is deliberately separated from the handler that writes records, and community backends are indexed under the
swift-log keyword.
- CMake build support for integrated or mixed build environments, with the project's tests remaining under Swift Package Manager and run through
swift test.
- DocC-based documentation and tutorials published on the Swift Package Index, plus release tags surfaced through the repository's release badge.
- Apache 2.0 licensing stated in
LICENSE.txt, with contribution guidance in CONTRIBUTING.md and a documented security reporting process.
Who uses it and how
- Server-side Swift applications, the environment the
swift-server topic indicates, which adopt the API and pair it with a selected backend handler for production output.
- Package and library authors who want to log through a stable interface without forcing a particular implementation on the applications that depend on them.
- Applications that need consistent structured context, attaching values such as a request identifier to a logger so that downstream records carry the same field.
- Teams working in mixed or integrated build setups that include CMake alongside Swift Package Manager.
- Projects that must be able to swap the destination of their logs by changing the chosen backend rather than rewriting call sites.
Getting started
Add the package https://github.com/apple/swift-log at version 1.6.0 or later to the SPM manifest, depend on the Logging product, and use import Logging to create a logger with Logger(label:). Documentation and tutorials are available on the Swift Package Index.
How it compares
No directly comparable alternative is named in the facts provided for this registry, so SwiftLog stands alone here rather than being contrasted with a listed set of paid products. Its position is defined by what it is: a permissively licensed, openly developed logging API rather than a hosted service or a bundled log-management product.
When to use it — and when not to
Adopting SwiftLog means also adopting a logging backend, because the package defines the call surface and leaves emission to a handler that the adopter selects, configures and operates. It is a poor fit for anyone who wants a turnkey logging implementation with storage, shipping or retention included, and for applications whose logging needs are already satisfied by a single backend that exposes its own API. The honest limitation is structural: the repository provides an interface, so its value depends on the quality and maintenance of whatever community backend is chosen alongside it.
project readme (upstream, from github) — read inline
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-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:
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.
Building with CMake
While Swift Package Manager (SPM) is the primary build system for development and testing, CMake build support is also available for integrated or mixed build environments if needed. Note that tests are not included in the CMake build, they are managed through Swift Package Manager with swift test.