mirror of
https://github.com/apple/swift-log
synced 2026-11-26 04:07:49 +00:00
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.9 KiB
1.9 KiB
Logging/Logger
Topics
Creating Loggers
init(label:)init(label:metadataProvider:)init(label:factory:)-9uiy2init(label:factory:)-6iktuMetadataProvider
Sending trace log messages
trace(_:metadata:file:function:line:)trace(_:metadata:source:file:function:line:)trace(_:error:metadata:source:file:function:line:)
Sending debug log messages
debug(_:metadata:file:function:line:)debug(_:metadata:source:file:function:line:)debug(_:error:metadata:source:file:function:line:)
Sending info log messages
info(_:metadata:file:function:line:)info(_:metadata:source:file:function:line:)info(_:error:metadata:source:file:function:line:)
Sending notice log messages
notice(_:metadata:file:function:line:)notice(_:metadata:source:file:function:line:)notice(_:error:metadata:source:file:function:line:)
Sending warning log messages
warning(_:metadata:file:function:line:)warning(_:metadata:source:file:function:line:)warning(_:error:metadata:source:file:function:line:)
Sending error log messages
error(_:metadata:file:function:line:)error(_:metadata:source:file:function:line:)error(_:error:metadata:source:file:function:line:)
Sending critical log messages
critical(_:metadata:file:function:line:)critical(_:metadata:source:file:function:line:)critical(_:error:metadata:source:file:function:line:)
Sending general log messages
log(level:_:metadata:file:function:line:)log(level:_:metadata:source:file:function:line:)log(level:_:error:metadata:source:file:function:line:)LevelMessageMetadata
Adjusting logger metadata
subscript(metadataKey:)MetadataValue
Metadata attribute types
MetadataValueAttributes
Inspecting a logger
labellogLevelhandlermetadataProvider