This commit is contained in:
liris
2015-04-17 09:35:37 +09:00
parent 56c4e9c7c1
commit 78c13538a4
3 changed files with 7 additions and 7 deletions

View File

@@ -231,6 +231,6 @@ class WebSocketApp(object):
callback(self, *args) callback(self, *args)
except Exception as e: except Exception as e:
error(e) error(e)
if isEnableForDebug(): if isEnabledForDebug():
_, _, tb = sys.exc_info() _, _, tb = sys.exc_info()
traceback.print_tb(tb) traceback.print_tb(tb)

View File

@@ -428,7 +428,7 @@ class WebSocket(object):
self.sock.settimeout(3) self.sock.settimeout(3)
try: try:
frame = self.recv_frame() frame = self.recv_frame()
if isEnableForError(): if isEnabledForError():
recv_status = struct.unpack("!H", frame.data)[0] recv_status = struct.unpack("!H", frame.data)[0]
if recv_status != STATUS_NORMAL: if recv_status != STATUS_NORMAL:
error("close status: " + repr(recv_status)) error("close status: " + repr(recv_status))

View File

@@ -26,7 +26,7 @@ _logger = logging.getLogger()
_traceEnabled = False _traceEnabled = False
__all__ = ["enableTrace", "dump", "error", "debug", "trace", __all__ = ["enableTrace", "dump", "error", "debug", "trace",
"isEnableForError", "isEnableForDebug"] "isEnabledForError", "isEnabledForDebug"]
def enableTrace(tracable): def enableTrace(tracable):
@@ -63,9 +63,9 @@ def trace(msg):
_logger.debug(msg) _logger.debug(msg)
def isEnableForError(): def isEnabledForError():
return _logger.isEnableFor(logging.ERROR) return _logger.isEnabledFor(logging.ERROR)
def isEnableForDebug(): def isEnabledForDebug():
return _logger.isEnableFor(logging.DEBUG) return _logger.isEnabledFor(logging.DEBUG)