Skip to content

[SLG-0004]: metadata value attributes implementation#453

Merged
kukushechkin merged 17 commits into
apple:mainfrom
kukushechkin:attributed-metadata-as-stringConvertible
May 22, 2026
Merged

[SLG-0004]: metadata value attributes implementation#453
kukushechkin merged 17 commits into
apple:mainfrom
kukushechkin:attributed-metadata-as-stringConvertible

Conversation

@kukushechkin

@kukushechkin kukushechkin commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

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.

@kukushechkin kukushechkin added the 🆕 semver/minor Adds new public API. label Apr 29, 2026
@kukushechkin
kukushechkin force-pushed the attributed-metadata-as-stringConvertible branch from 2a25dbc to aa366c5 Compare April 29, 2026 13:25
@kukushechkin
kukushechkin force-pushed the attributed-metadata-as-stringConvertible branch 3 times, most recently from f294301 to 9e7b525 Compare April 29, 2026 14:07
@kukushechkin
kukushechkin requested review from FranzBusch and weissi and removed request for FranzBusch April 30, 2026 09:53
Comment thread Sources/Logging/Logger.swift Outdated
@kukushechkin
kukushechkin force-pushed the attributed-metadata-as-stringConvertible branch from 5500ff2 to d87e798 Compare April 30, 2026 15:05
@kukushechkin kukushechkin changed the title [SLG-0004]: Revised Metadata value attributes as CustomStringConvertible [SLG-0004]: Revised metadata value attributes as CustomStringConvertible May 5, 2026
@kukushechkin kukushechkin changed the title [SLG-0004]: Revised metadata value attributes as CustomStringConvertible [SLG-0004]: metadata value attributes (revision 2 aka CustomStringConvertible) May 5, 2026
@kukushechkin
kukushechkin force-pushed the attributed-metadata-as-stringConvertible branch 2 times, most recently from 5e053d0 to d32532b Compare May 13, 2026 13:21
@kukushechkin

Copy link
Copy Markdown
Contributor Author

@kukushechkin kukushechkin changed the title [SLG-0004]: metadata value attributes (revision 2 aka CustomStringConvertible) [SLG-0004]: metadata value attributes implementation May 13, 2026
@kukushechkin
kukushechkin marked this pull request as ready for review May 13, 2026 15:33
@kukushechkin
kukushechkin requested a review from weissi May 13, 2026 15:33
@kukushechkin
kukushechkin force-pushed the attributed-metadata-as-stringConvertible branch 2 times, most recently from 8f344ac to 86208e0 Compare May 19, 2026 14:07
@kukushechkin
kukushechkin force-pushed the attributed-metadata-as-stringConvertible branch from 968b9cb to 1197cb4 Compare May 19, 2026 14:38
Comment thread Sources/Logging/Logger+Attributes.swift Outdated
Comment thread Sources/Logging/Logger+Attributes.swift Outdated
Comment thread Sources/Logging/Logger+Attributes.swift
Comment thread Sources/Logging/Logger+Attributes.swift Outdated
Comment thread Sources/Logging/Logger+Attributes.swift Outdated

@FranzBusch FranzBusch left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment thread Sources/Logging/Docs.docc/DisableLogLevelsDuringCompilation.md
Comment thread Sources/Logging/Logger+Attributes.swift Outdated
Comment thread Tests/LoggingTests/MetadataAttributesTest.swift Outdated
@kukushechkin
kukushechkin merged commit 7dc6101 into apple:main May 22, 2026
53 checks passed
@kukushechkin kukushechkin linked an issue May 29, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🆕 semver/minor Adds new public API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Adding support for privacy level in string interpolation

3 participants