Default logging won't use another dispatch queue

This commit is contained in:
Erik 2015-09-03 15:14:25 -04:00
parent 8d0af14f04
commit a147ebcd85

View File

@ -43,21 +43,15 @@ public protocol SocketLogger {
}
extension SocketLogger {
private var printQueue: dispatch_queue_t {
return dispatch_queue_create("printQueue", DISPATCH_QUEUE_SERIAL)
}
public func log(message: String, client: SocketLogClient, altType: String?, args: AnyObject...) {
if !log {
return
}
dispatch_async(printQueue) {[type = client.logType] in
let newArgs = args.map {String($0)}
let replaced = String(format: message, arguments: newArgs)
NSLog("%@: %@", altType ?? type, replaced)
}
NSLog("%@: %@", altType ?? client.logType, replaced)
}
public func err(message: String, client: SocketLogClient, altType: String?, args: AnyObject...) {
@ -65,12 +59,10 @@ extension SocketLogger {
return
}
dispatch_async(printQueue) {[type = client.logType] in
let newArgs = args.map {String($0)}
let replaced = String(format: message, arguments: newArgs)
NSLog("ERROR %@: %@", altType ?? type, replaced)
}
NSLog("ERROR %@: %@", altType ?? client.logType, replaced)
}
}