use static variable for log
This commit is contained in:
parent
2351637ab4
commit
4fdb49ea2f
@ -64,7 +64,6 @@ public final class SocketEngine: NSObject, WebSocketDelegate, SocketLogClient {
|
||||
|
||||
weak var client: SocketEngineClient?
|
||||
var cookies: [NSHTTPCookie]?
|
||||
var log = false
|
||||
var sid = ""
|
||||
var socketPath = ""
|
||||
var urlPolling: String?
|
||||
@ -94,7 +93,6 @@ public final class SocketEngine: NSObject, WebSocketDelegate, SocketLogClient {
|
||||
forceWebsockets = opts?["forceWebsockets"] as? Bool ?? false
|
||||
forcePolling = opts?["forcePolling"] as? Bool ?? false
|
||||
cookies = opts?["cookies"] as? [NSHTTPCookie]
|
||||
log = opts?["log"] as? Bool ?? false
|
||||
socketPath = opts?["path"] as? String ?? ""
|
||||
extraHeaders = opts?["extraHeaders"] as? [String: String]
|
||||
}
|
||||
|
||||
@ -35,7 +35,6 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
|
||||
let logType = "SocketClient"
|
||||
var ackHandlers = SocketAckManager()
|
||||
var currentAck = -1
|
||||
var log = false
|
||||
var waitingData = [SocketPacket]()
|
||||
|
||||
public let emitQueue = dispatch_queue_create("emitQueue", DISPATCH_QUEUE_SERIAL)
|
||||
@ -73,7 +72,7 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
|
||||
}
|
||||
|
||||
if let log = opts?["log"] as? Bool {
|
||||
self.log = log
|
||||
SocketLogger.log = log
|
||||
}
|
||||
|
||||
if let nsp = opts?["nsp"] as? String {
|
||||
|
||||
@ -25,19 +25,19 @@
|
||||
import Foundation
|
||||
|
||||
protocol SocketLogClient {
|
||||
var log: Bool {get set}
|
||||
var logType: String {get}
|
||||
}
|
||||
|
||||
final class SocketLogger {
|
||||
private static let printQueue = dispatch_queue_create("printQueue", DISPATCH_QUEUE_SERIAL)
|
||||
static var log = false
|
||||
|
||||
private static func toCVArgType(item: AnyObject) -> CVarArgType {
|
||||
return String(item)
|
||||
}
|
||||
|
||||
static func log(message: String, client: SocketLogClient, altType: String? = nil, args: AnyObject...) {
|
||||
if !client.log {
|
||||
if !log {
|
||||
return
|
||||
}
|
||||
|
||||
@ -50,7 +50,7 @@ final class SocketLogger {
|
||||
}
|
||||
|
||||
static func err(message: String, client: SocketLogClient, altType: String? = nil, args: AnyObject...) {
|
||||
if !client.log {
|
||||
if !log {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user