We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent db86ac7 commit cea90ddCopy full SHA for cea90dd
Sources/Logging/Logging.swift
@@ -166,6 +166,17 @@ extension Logger {
166
}
167
168
169
+ /// Convenience function for adding multiple metadata items to a logger.
170
+ ///
171
+ /// - note: Logging metadata behaves as a value that means a change to the logging metadata will only affect the
172
+ /// very `Logger` it was changed on.
173
+ @inlinable
174
+ public mutating func withMetadata(metadata: Logger.Metadata) {
175
+ metadata.forEach { (key, value) in
176
+ self.handler[metadataKey: key] = value
177
+ }
178
179
+
180
/// Get or set the log level configured for this `Logger`.
181
///
182
/// - note: `Logger`s treat `logLevel` as a value. This means that a change in `logLevel` will only affect this
0 commit comments