Skip to content
CAI
Software that uses CAICheck a score

apple/swift-log

63.1

Adequate · 30 September 2026

4.9k

lines of production code

Swift

primary language

2

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

This system is the swift-log library, a logging framework for Swift that provides core logging APIs, an in-memory handler for testing, and CMake build support. It enables compile-time log level elimination to reduce binary size and overhead, while offering comprehensive benchmarking infrastructure to measure performance impacts of features like task-local loggers and metadata handling.

Features

Added CMake support for Swift targets and test configurations

The build system now includes CMake modules to support Swift targets. This adds infrastructure for detecting the Swift compiler, determining the module triple, and installing Swift modules and documentation files alongside C++ artifacts, enabling users to build and install Swift components using CMake.

cmake · high confidence

Added basic usage snippet for the Logging API

A new Swift code snippet demonstrating how to import the Logging API, create a logger with a label, and log an informational message has been added to the documentation resources.

Snippets · high confidence

Added benchmarking infrastructure for logging performance

Added new benchmarking utilities in Benchmarks/Sources to measure logging performance. This includes a MakeBenchmark helper that configures benchmark runs with instruction and object allocation metrics, and a NoOpLogHandler that implements the LogHandler protocol to capture LogEvent and metadata attributes without producing output, enabling accurate performance measurement of logging operations.

Benchmarks/Sources · high confidence

New InMemoryLogHandler and CMake build support

The library now includes an InMemoryLogHandler in the InMemoryLogging module, allowing tests to capture and inspect log entries without process-wide bootstrapping. CMake build files have been added for both the Logging and InMemoryLogging modules to support CMake-based builds.

Sources · high confidence

SwiftLog now supports compile-time log level elimination via package traits

SwiftLog introduces new package traits (MaxLogLevelDebug through MaxLogLevelNone) that allow developers to eliminate unused log levels at compile time, reducing binary size and overhead. This feature is available starting with Swift 6.1 and is configured via the [e-mail redacted] manifest, enabling users to tailor logging verbosity to their specific needs without runtime cost.

(repo-wide) · high confidence

Test coverage

Add benchmark suite for MaxLogLevelNone optimization; Added benchmarks for task-local loggers and metadata sensitivity; Added tests for InMemoryLogHandler; Added tests for the new Swift Testing framework migration and logging API compatibility.

Dependencies

Swift 6.2 upgrade and compile-time log level traits

The package now requires Swift 6.2 and introduces compile-time log level traits (MaxLogLevelNone through MaxLogLevelDebug) that allow users to strip unused log levels from the binary at build time. The package name has changed to swift-log, exposing Logging and InMemoryLogging products, and enables strict concurrency and upcoming compiler features for improved type safety.

(dependencies) · high confidence

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Score

  • CAI 65 → 63 (-1.7)
  • Rubric changed (rubric-2026.09.11 → rubric-2026.09.18) — scores are not directly comparable.

Lenses

  • Code Health 98 → 98 (-0.6)
  • Architecture 100 → 96 (-3.7)
  • Maturity 58 → 57 (-0.4)
  • Readiness 61 → 65 (+4.1)
  • Security 61 → 61 (+0.0)
  • Performance 73 (new)

Resolved (3)

  • Documentation: no installation or build instructions (README.md)
  • Documentation: no usage examples (README.md)
  • Off-boarding risk: anonymized user #1

New (9)

  • Dependency hygiene PARTLY measured — SwiftPM pinning read, dependency currency NOT established
  • MultiplexLogHandler.metadataProvider (cognitive 21) (Sources/Logging/Handlers/MultiplexLogHandler.swift)
  • No Package.resolved committed (Benchmarks/MaxLogLevelNone/Package.swift)
  • No Package.resolved committed (Benchmarks/MaxLogLevelWarning/Package.swift)
  • No Package.resolved committed (Benchmarks/NoTraits/Package.swift)
  • Off the main sequence: Logging
  • Off-boarding risk: anonymized user #1
  • Redundant logging entry points: The LogHandler protocol exposes both a high-level 'event' based method and a low-level parameterized method. While this allows flexibility, it creates ambiguity for implementers (e.g., InMemoryLogHandler, StreamLogHandler) who must implement both, often leading to code duplication or delegation patterns that are not explicitly enforced by the protocol structure.
  • Verbosity vs. Convenience: The Logger exposes both a generic 'log(level:)' method and specific convenience methods for each log level. While this is a common pattern, it duplicates the intent of 'logging a message' across 9 different method names. For API consistency, users must choose between using the generic method with an enum or the specific methods, which can lead to inconsistent usage patterns within a codebase.

Changes since last survey

  • 3 commits — 2 feature/other, 1 fixes

By area

  • (root) — 2 commits
  • Benchmarks/NoTraits — 1 commit

Notable commits

  • fix: Fix nested metadata values handling (#516)
  • change: Remove invalid exclude statements from testTarget (#514)
  • change: Update stale package names and broken ordo-one/benchmark documentation links (#511)

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

apple/swift-log was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 30 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 9c9acde6dc9bffb0727cfecb7f61228bc416b33f — the exact code this score is about.
  • Scored under rubric-2026.09.18 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-cb25ca4feafa.