Browse Source

fix: warning -> logging

pull/1517/head
phi 8 months ago
parent
commit
f4b635ee8f
  1. 10
      src/socketio/packet.py

10
src/socketio/packet.py

@ -1,5 +1,5 @@
import functools import functools
import warnings import logging
from engineio import json as _json from engineio import json as _json
(CONNECT, DISCONNECT, EVENT, ACK, CONNECT_ERROR, BINARY_EVENT, BINARY_ACK) = \ (CONNECT, DISCONNECT, EVENT, ACK, CONNECT_ERROR, BINARY_EVENT, BINARY_ACK) = \
@ -7,6 +7,7 @@ from engineio import json as _json
packet_names = ['CONNECT', 'DISCONNECT', 'EVENT', 'ACK', 'CONNECT_ERROR', packet_names = ['CONNECT', 'DISCONNECT', 'EVENT', 'ACK', 'CONNECT_ERROR',
'BINARY_EVENT', 'BINARY_ACK'] 'BINARY_EVENT', 'BINARY_ACK']
logger = logging.getLogger('socketio.packet')
class Packet: class Packet:
"""Socket.IO packet.""" """Socket.IO packet."""
@ -202,12 +203,13 @@ class Packet:
try: try:
args_hash = hash(configure_args) args_hash = hash(configure_args)
except TypeError: except TypeError:
warnings.warn('Packet.configure() called with unhashable ' logger.warning("Packet.configure() called with unhashable "
'arguments; subclass caching will not work.', "arguments; subclass caching will not work.")
RuntimeWarning)
args_hash = None args_hash = None
if args_hash in cls._subclass_registry: if args_hash in cls._subclass_registry:
logger.debug("Using cached Packet subclass for args %s, %s",
args, kwargs)
return cls._subclass_registry[args_hash] return cls._subclass_registry[args_hash]
return cls._configure(*args, **kwargs) return cls._configure(*args, **kwargs)

Loading…
Cancel
Save