From f4b635ee8f3b4a8d7a176424aca4a648d13fa4aa Mon Sep 17 00:00:00 2001 From: phi Date: Wed, 5 Nov 2025 19:57:29 +0900 Subject: [PATCH] fix: warning -> logging --- src/socketio/packet.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/socketio/packet.py b/src/socketio/packet.py index dea5a8e..61b3836 100644 --- a/src/socketio/packet.py +++ b/src/socketio/packet.py @@ -1,5 +1,5 @@ import functools -import warnings +import logging from engineio import json as _json (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', 'BINARY_EVENT', 'BINARY_ACK'] +logger = logging.getLogger('socketio.packet') class Packet: """Socket.IO packet.""" @@ -202,12 +203,13 @@ class Packet: try: args_hash = hash(configure_args) except TypeError: - warnings.warn('Packet.configure() called with unhashable ' - 'arguments; subclass caching will not work.', - RuntimeWarning) + logger.warning("Packet.configure() called with unhashable " + "arguments; subclass caching will not work.") args_hash = None 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._configure(*args, **kwargs)