Skip to content

Heads-up: breaking change in swift-log 1.13Β #31

Description

@kukushechkin

Hey folks πŸ‘‹

A heads-up from the swift-log side. We shipped 1.13.0 recently and uncovered a subtle source-compatibility regression. While checking which public adopters might be affected, your repo came up β€” figured it was friendlier to flag it here than let you trip over it on your next dependency bump.

We're tracking it at apple/swift-log#467, along with recommended ways to mitigate the breakage.

What's going on

1.13 implements SLG-0004: Metadata Value Attributes. The relevant detail: Logger.MetadataValue now uses its own custom StringInterpolation type instead of DefaultStringInterpolation. So any appendInterpolation(...) you've added to String.StringInterpolation won't be visible when the interpolation feeds directly into a Logger.MetadataValue.

Minimal repro:

extension String.StringInterpolation {
    mutating func appendInterpolation(myCustomInterpolation value: Int) {
        self.appendLiteral("Int=\(value)")
    }
}

logger.info("Log message", metadata: [
    "key": "\(myCustomInterpolation: 42)"  // error: No exact matches in call to instance method 'info'
])

It's a real SemVer break, but the use case is niche enough that we're planning to keep the change and have adopters work around it. If the workarounds don't cover your case, a comment on the upstream issue is still useful β€” helps us figure out if we need to do more on our end (better docs, migration notes, etc.).

Cheers!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions