Skip to content

[SLG-0004]: Revised Metadata value attributes + sensitivity attribute implementation#439

Closed
kukushechkin wants to merge 7 commits into
apple:mainfrom
kukushechkin:metadata-privacy-labels-external-attributes-slots
Closed

[SLG-0004]: Revised Metadata value attributes + sensitivity attribute implementation#439
kukushechkin wants to merge 7 commits into
apple:mainfrom
kukushechkin:metadata-privacy-labels-external-attributes-slots

Conversation

@kukushechkin
Copy link
Copy Markdown
Contributor

@kukushechkin kukushechkin commented Apr 9, 2026

Important

This is a revision of SLG-0004 previously discussed here. Note this is a draft, including more than just the proposal implementation.

Add an extensible per-value attribute mechanism for metadata, with sensitivity as the first attribute.

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 generic AttributedMetadataValue-based mechanism to Logging.
  • Added Sensitivity attribute to the new LoggingSensitivity target.
  • Added OSLogHandler as an example of a concrete log handler taking advantage of the Sensitivity attribute.
  • Added benchmarks and benchmark thresholds for the new attributed metadata.

Result:

  • swift-log provides an optional extensible mechanism for attaching attributes to metadata values.
  • swift-log provides a common Sensitivity attribute and examples how to use it.

@kukushechkin kukushechkin added the 🆕 semver/minor Adds new public API. label Apr 9, 2026
@kukushechkin kukushechkin force-pushed the metadata-privacy-labels-external-attributes-slots branch 5 times, most recently from f965af9 to 7a1a084 Compare April 9, 2026 16:25
@kukushechkin kukushechkin changed the title SLG-0004 (revised): Attributed metadata values + sensitivity attribute SLG-0004 (revised): Metadata value attributes + sensitivity attribute implementation Apr 9, 2026
@kukushechkin kukushechkin changed the title SLG-0004 (revised): Metadata value attributes + sensitivity attribute implementation [SLG-0004]: Revised Metadata value attributes + sensitivity attribute implementation Apr 9, 2026
@kukushechkin kukushechkin linked an issue Apr 14, 2026 that may be closed by this pull request
Copy link
Copy Markdown
Member

@weissi weissi left a comment

Choose a reason for hiding this comment

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

The general idea and the implementation suggestion of using a fixed-sized inline slot is good.

But overall -1 because of these concerns:

  • Major concern: Complete bifurcation of SwiftLog's core APIs. There's a new LogMessage called LogEvent. There's new, duplicated metadata. This is essentially shipping a whole new version disguised as a feature addition.
  • Major concern: Bundles with sensitivity, privileges sensitivity & introduces unduly policy decisions regarding sensitivity into the core mechanism package. This one's easy to fix, remove anything relating to sensitivity from this proposal and create a new package swift-log-sensitivity-attributes that has no special privileges
  • Minor: Reveals too much about how the storage is implemented without reason

}
```

#### Adopting attributed metadata in LogHandlers
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.

I think the adoption should not be this difficult. What we're proposing in disguise in this proposal is to essentially create a whole second API for SwiftLog. I do not think that this is a good direction.

@kukushechkin kukushechkin force-pushed the metadata-privacy-labels-external-attributes-slots branch from 7a1a084 to 44cf766 Compare April 23, 2026 14:25
@kukushechkin kukushechkin force-pushed the metadata-privacy-labels-external-attributes-slots branch from 44cf766 to c080098 Compare April 23, 2026 14:43
@kukushechkin kukushechkin force-pushed the metadata-privacy-labels-external-attributes-slots branch from c080098 to b689899 Compare April 23, 2026 15:43
@kukushechkin
Copy link
Copy Markdown
Contributor Author

Closed in favor of #453

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

2 participants