add support for local metadata (#16)

motivation: allow users to define metadata at the log API call site

changes: add metadata param to all log APIs, and implement merge at our example implementations
This commit is contained in:
tomer doron authored and Johannes Weiss committed 2019-01-09 12:04:59 +00:00
1 parent 5ca706eb48
commit a0c3ceabdf
7 files changed
+55 -37

No files matched your search

@@ -24,8 +24,8 @@ public final class SimpleLogging {
self.defaultLogLevel = defaultLogLevel
}
public func log(level: Logging.Level, message: String, error: Error?, file: StaticString, function: StaticString, line: UInt) {
self.logger.log(level: level, message: message, error: error) { text in
public func log(level: Logging.Level, message: String, metadata: Logging.Metadata?, error: Error?, file: StaticString, function: StaticString, line: UInt) {
self.logger.log(level: level, message: message, metadata: metadata, error: error) { text in
print(text)
}
}