add logger API variants that take an error (#12)

motivation: easily log errors w/o converting them to string first

changes:
* add another set of logger APIs that take in an error object
* add tests and refactor testing assertions
* add autoclosure tests to make sure its resoved on when log level is appropriate
This commit is contained in:
tomer doron authored and Johannes Weiss committed 2019-01-08 20:41:03 +00:00
1 parent 5527732754
commit 19d987b6d5
9 files changed
+224 -142

No files matched your search

@@ -24,8 +24,8 @@ public final class SimpleLogging {
self.defaultLogLevel = defaultLogLevel
}
public func log(level: Logging.Level, message: String, file: StaticString, function: StaticString, line _: UInt) {
self.logger.log(level: level, message: message) { text in
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
print(text)
}
}