Skip to content

Tags: apple/swift-log

Tags

1.13.2

Toggle 1.13.2's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Add `(default:)` string interpolation overloads (#471)

Add [Default String
Interpolation](https://github.com/swiftlang/swift-evolution/blob/main/proposals/0477-default-interpolation-values.md)
overloads for `MetadataValue` to restore compatibility with
`\(default:)` interpolation.

### Motivation:

1.13.0 introduced a breaking change to the default string interpolation
compatibility. We do not want to revert the custom string interpolation,
but can fix compatibility with the default string interpolation as much
as possible.

### Modifications:

Add `\(default:)` overloads to `MetadataValue.StringInterpolation`,
similar to the once in `DefaultStringInterpolation`.

### Result:

Compatibility with `logger.info("Log message", metadata: ["value":
"\(value, default: "none")"])` is restored.

1.13.1

Toggle 1.13.1's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Match `DefaultStringInterpolation` `appendInterpolation ` overloads (#…

…469)

Custom `MetadataValue.StringInterpolation` broke compatibility with
`DefaultStringInterpolation`. Rearrange `appendInterpolation` overloads
to match `DefaultStringInterpolation` to maintain backward
compatibility.

### Motivation:

Custom `MetadataValue.StringInterpolation` broke compatibility with
`DefaultStringInterpolation`. Rearrange `appendInterpolation` overloads
to match `DefaultStringInterpolation` to maintain backward
compatibility.

### Modifications:

`MetadataValue.StringInterpolation` `appendInterpolation` overloads
changed.

### Result:

Code relying on matching correct `DefaultStringInterpolation`
`appendInterpolation` overload compiles.

1.13.0

Toggle 1.13.0's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
[SLG-0004]: metadata value attributes implementation (#453)

Proposal discussion thread:
https://forums.swift.org/t/proposal-slg-0004-metadata-value-attributes-revision-2/86488

Add an extensible per-value attribute mechanism for metadata.

### Motivation:

Metadata values in `swift-log` are opaque strings by the time the
`LogHandler` receives them. The call site often
knows things about a value that the handler cannot infer — for example,
whether the value should be redacted in
different environments.

### Modifications:

- SLG-0004 proposal is updated based on the feedback. 
- Added `AttributedStringCarrier: CustomStringConvertible`-based
mechanism to `Logging`.
- Added benchmarks and benchmark thresholds for the new attributed
metadata.

### Result:

`swift-log` provides an optional extensible mechanism for attaching
attributes to metadata values.

---------

Co-authored-by: Franz Busch <privat@franz-busch.de>

1.12.1

Toggle 1.12.1's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Adopt multi-package macOS benchmarks workflow (#466)

### Motivation

* The two-invocation pattern for `macos-benchmarks` and
`macos-benchmarks-MaxLogLevelWarningBenchmarks-trait` allocates one
self-hosted macOS runner per (Swift version x package), incurring
duplicate runner-recycling cost.
* The recent change on main adds a `benchmark_package_paths` input
letting a single invocation run all packages serially on each runner.

### Modifications

* Replace the two macOS benchmark jobs in `main.yml` and
`pull_request.yml` with a single consolidated job that passes both
packages via `benchmark_package_paths: '["Benchmarks/NoTraits",
"Benchmarks/MaxLogLevelWarning"]'`.
* Drop Swift 6.2 from the matrix; only Swift 6.3 is shared between the
two packages (`MaxLogLevelWarning` has no `Thresholds/Xcode swift
6.2/`).

### Result

* One macOS runner allocation per Swift version instead of one per
(version x package).
* `NoTraits` loses Swift 6.2 coverage

1.12.0

Toggle 1.12.0's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
SLG-0003: Error parameter implementation (#425)

Add new methods on `Logger` that allows the caller to attach `Error`s to
log events, which will be propagated to the `LogHandler` as-is.

### Motivation:

Error information is typically of high interest in logs and log
analysis. Currently, however, there is no standardized way of attaching
`Error` information to logs, forcing users to either append it to the
log message (`logger.warning("Something went wrong: \(error)")`), or
attach it as metadata. By providing a separate parameter for this, and
passing it as-is to the `LogHandler`, we both provide a standard,
visible way to attach it, while also letting the `LogHandler` format it
as it sees fit.
Closes #291 

### Modifications:

* New methods on `Logger` that accept an (optional) `Error`.
* An `error` property is added to `LogEvent`, which contains the `Error`
from the new `Logger` methods.
* Adjust `LogHandler` implementations to serialize error as metadata.

### Result:

Users of `Logger` can use the new methods to attach `Error`s to their
logs, which should help unify how `Error`s get logged in various code
bases.
`LogHandler` implementations can use the new `error` property on
`LogEvent` and serialize it in a way that's suitable for that
implementation. In general, extracting the string representation and the
(qualified) type name should be a good baseline.

---------

Co-authored-by: Vladimir Kukushkin <kukushechkin@mac.com>

1.11.0

Toggle 1.11.0's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
[CI] Add automated release workflow using swift-temporal-sdk (#434)

Integrate swift-temporal-sdk's reusable auto-release workflow for
automated semantic versioning releases. Update CONTRIBUTING.md with a
link to the workflow documentation.

### Motivation

- Automate the release process using semantic versioning labels,
reducing manual overhead and ensuring consistent versioning across
releases.

### Modifications

- Add .github/workflows/auto-release.yml that uses swift-temporal-sdk's
reusable workflow
- Update CONTRIBUTING.md with automated release process documentation
linking to swift-temporal-sdk's workflow README

### Result

- When PRs are merged with semver labels (semver/patch, semver/minor),
the workflow automatically creates GitHub releases. Major releases
require manual creation.

### Test Plan

- Workflow will be validated after merge by labeling PRs with semver
labels and verifying that releases are created automatically.

1.10.1

Toggle 1.10.1's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Fix: Only use unsafe flag on Swift 6.2 (#411)

### Motivation:

Package.swift needs to use tools-version 6.2, as we have dedicated 6.0
and 6.1 manifests.

Here, when building on 6.1, the Package.swift was being picked and an
unsafe flag was found, which isn't allowed on 6.1 (only on 6.2+).

### Modifications:

Bump Package.swift's tools-version to 6.2.

### Result:

Should fix dependees.

1.10.0

Toggle 1.10.0's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
chore: update Lock implementation with latest changes from swift-nio (#…

…408)

Ports changes to `Lock` from swift-nio to swift-log.

### Motivation:

The copy-paste of `Lock` in swift-log should be updated with changes
from swift-nio.

### Modifications:

- Rolls back changed [made previously for
FreeBSD](https://github.com/apple/swift-log/pull/387/changes#diff-7b1bd45403dd1a7418287bd60682bf05ba2e4bf75dca1c0ca55a86d0477c9af5L73)
in favor of a consolidated implementation in swift-nio that will be in
place once apple/swift-nio#3494 merges. @kkebo
Please confirm this works. After both of our PR's merge, swift-log and
swift-nio will have the same implementation as far as FreeBSD is
concerned.
- Brought the following recent changes from swift-nio over to swift-log:

  - apple/swift-nio#3482
  - apple/swift-nio#3480
  - apple/swift-nio#3483

- Removed stale `// SRWLOCK does not need to be free'd` comment.

### Result:

`Lock` implementation will have the same implementation as swift-nio
(assuming apple/swift-nio#3494 merges).

1.9.1

Toggle 1.9.1's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Reinstate InMemoryLogging product in Swift 6.0 manifest (#403)

### Motivation:

In the latest release (1.9.0) the package manifest was split for Swift
6.0 and 6.1+. The 6.0 manifest lost the `InMemoryLogging` library
product, causing API breakage for adopters using Swift 6.0:

```diff
% diff -u <(git show 1.8.0:Package.swift) <(git show 1.9.0:Package@swift-6.0.swift)
--- /dev/fd/63  2026-01-19 10:30:21
+++ /dev/fd/62  2026-01-19 10:30:21
@@ -18,25 +18,16 @@
 let package = Package(
     name: "swift-log",
     products: [
-        .library(name: "Logging", targets: ["Logging"]),
-        .library(name: "InMemoryLogging", targets: ["InMemoryLogging"]),
+        .library(name: "Logging", targets: ["Logging"])
     ],
     targets: [
         .target(
             name: "Logging",
             dependencies: []
         ),
-        .target(
-            name: "InMemoryLogging",
-            dependencies: ["Logging"]
-        ),
         .testTarget(
             name: "LoggingTests",
             dependencies: ["Logging"]
-        ),
-        .testTarget(
-            name: "InMemoryLoggingTests",
-            dependencies: ["InMemoryLogging", "Logging"]
         ),
     ]
 )

```

### Modifications:

Reinstate InMemoryLogging product in Swift 6.0 manifest

### Result:

Adopters using `InMemoryLogging` on Swift 6.0 are unbroken.

### Related issues:

Fixes #402

1.9.0

Toggle 1.9.0's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
The SLG-0002 implementation is merged, update the proposal status (#399)

Just bumping the status before making the release.