mirror of
https://github.com/apple/swift-log
synced 2026-11-24 03:47:49 +00:00
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:
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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user