From e37d44924b540204465183a64778774ad9415228 Mon Sep 17 00:00:00 2001 From: Julien Enselme Date: Thu, 22 Aug 2024 09:14:15 +0200 Subject: [PATCH] Switch to log.warning instead of log.warn log.warn is removed in Python 3.13 Close #1098 --- autobahn/asyncio/component.py | 2 +- autobahn/asyncio/rawsocket.py | 8 +++--- autobahn/twisted/choosereactor.py | 16 +++++------ autobahn/twisted/component.py | 4 +-- autobahn/twisted/rawsocket.py | 47 ++++++++++++++++--------------- autobahn/wamp/component.py | 4 +-- autobahn/wamp/protocol.py | 42 +++++++++++++-------------- autobahn/websocket/protocol.py | 14 ++++----- autobahn/xbr/_blockchain.py | 2 +- autobahn/xbr/_buyer.py | 8 +++--- autobahn/xbr/_cli.py | 10 +++---- autobahn/xbr/_gui.py | 10 +++---- autobahn/xbr/_seller.py | 22 +++++++-------- 13 files changed, 95 insertions(+), 94 deletions(-) diff --git a/autobahn/asyncio/component.py b/autobahn/asyncio/component.py index 3396c107a..06146aec1 100644 --- a/autobahn/asyncio/component.py +++ b/autobahn/asyncio/component.py @@ -304,7 +304,7 @@ def start(self, loop=None): """ if loop is None: - self.log.warn("Using default loop") + self.log.warning("Using default loop") loop = asyncio.get_event_loop() return self._start(loop=loop) diff --git a/autobahn/asyncio/rawsocket.py b/autobahn/asyncio/rawsocket.py index 0efebd7e5..0d1fb2af1 100644 --- a/autobahn/asyncio/rawsocket.py +++ b/autobahn/asyncio/rawsocket.py @@ -303,7 +303,7 @@ def _on_handshake_complete(self): self._session.onOpen(self) except Exception as e: # Exceptions raised in onOpen are fatal .. - self.log.warn("WampRawSocketProtocol: ApplicationSession constructor / onOpen raised ({err})", err=e) + self.log.warning("WampRawSocketProtocol: ApplicationSession constructor / onOpen raised ({err})", err=e) self.abort() else: self.log.info("ApplicationSession started.") @@ -316,11 +316,11 @@ def stringReceived(self, payload): self._session.onMessage(msg) except ProtocolError as e: - self.log.warn("WampRawSocketProtocol: WAMP Protocol Error ({err}) - aborting connection", err=e) + self.log.warning("WampRawSocketProtocol: WAMP Protocol Error ({err}) - aborting connection", err=e) self.abort() except Exception as e: - self.log.warn("WampRawSocketProtocol: WAMP Internal Error ({err}) - aborting connection", err=e) + self.log.warning("WampRawSocketProtocol: WAMP Internal Error ({err}) - aborting connection", err=e) self.abort() def send(self, msg): @@ -360,7 +360,7 @@ def _on_connection_lost(self, exc): self._session.onClose(wasClean) except Exception as e: # silently ignore exceptions raised here .. - self.log.warn("WampRawSocketProtocol: ApplicationSession.onClose raised ({err})", err=e) + self.log.warning("WampRawSocketProtocol: ApplicationSession.onClose raised ({err})", err=e) self._session = None def close(self): diff --git a/autobahn/twisted/choosereactor.py b/autobahn/twisted/choosereactor.py index ccffaafc1..2fc7234d5 100644 --- a/autobahn/twisted/choosereactor.py +++ b/autobahn/twisted/choosereactor.py @@ -94,11 +94,11 @@ def install_optimal_reactor(require_optimal_reactor=True): from twisted.internet import kqreactor kqreactor.install() except: - log.warn('Running on *BSD or MacOSX, but cannot install kqueue Twisted reactor: {tb}', tb=traceback.format_exc()) + log.warning('Running on *BSD or MacOSX, but cannot install kqueue Twisted reactor: {tb}', tb=traceback.format_exc()) else: log.debug('Running on *BSD or MacOSX and optimal reactor (kqueue) was installed.') else: - log.warn('Running on *BSD or MacOSX, but cannot install kqueue Twisted reactor, because another reactor ({klass}) is already installed.', klass=current_reactor) + log.warning('Running on *BSD or MacOSX, but cannot install kqueue Twisted reactor, because another reactor ({klass}) is already installed.', klass=current_reactor) if require_optimal_reactor: raise ReactorAlreadyInstalledError() else: @@ -114,11 +114,11 @@ def install_optimal_reactor(require_optimal_reactor=True): from twisted.internet.iocpreactor import reactor as iocpreactor iocpreactor.install() except: - log.warn('Running on Windows, but cannot install IOCP Twisted reactor: {tb}', tb=traceback.format_exc()) + log.warning('Running on Windows, but cannot install IOCP Twisted reactor: {tb}', tb=traceback.format_exc()) else: log.debug('Running on Windows and optimal reactor (ICOP) was installed.') else: - log.warn('Running on Windows, but cannot install IOCP Twisted reactor, because another reactor ({klass}) is already installed.', klass=current_reactor) + log.warning('Running on Windows, but cannot install IOCP Twisted reactor, because another reactor ({klass}) is already installed.', klass=current_reactor) if require_optimal_reactor: raise ReactorAlreadyInstalledError() else: @@ -134,11 +134,11 @@ def install_optimal_reactor(require_optimal_reactor=True): from twisted.internet import epollreactor epollreactor.install() except: - log.warn('Running on Linux, but cannot install Epoll Twisted reactor: {tb}', tb=traceback.format_exc()) + log.warning('Running on Linux, but cannot install Epoll Twisted reactor: {tb}', tb=traceback.format_exc()) else: log.debug('Running on Linux and optimal reactor (epoll) was installed.') else: - log.warn('Running on Linux, but cannot install Epoll Twisted reactor, because another reactor ({klass}) is already installed.', klass=current_reactor) + log.warning('Running on Linux, but cannot install Epoll Twisted reactor, because another reactor ({klass}) is already installed.', klass=current_reactor) if require_optimal_reactor: raise ReactorAlreadyInstalledError() else: @@ -156,11 +156,11 @@ def install_optimal_reactor(require_optimal_reactor=True): # from twisted.internet import default as defaultreactor # defaultreactor.install() except: - log.warn('Running on "{platform}", but cannot install Select Twisted reactor: {tb}', tb=traceback.format_exc(), platform=sys.platform) + log.warning('Running on "{platform}", but cannot install Select Twisted reactor: {tb}', tb=traceback.format_exc(), platform=sys.platform) else: log.debug('Running on "{platform}" and optimal reactor (Select) was installed.', platform=sys.platform) else: - log.warn('Running on "{platform}", but cannot install Select Twisted reactor, because another reactor ({klass}) is already installed.', klass=current_reactor, platform=sys.platform) + log.warning('Running on "{platform}", but cannot install Select Twisted reactor, because another reactor ({klass}) is already installed.', klass=current_reactor, platform=sys.platform) if require_optimal_reactor: raise ReactorAlreadyInstalledError() else: diff --git a/autobahn/twisted/component.py b/autobahn/twisted/component.py index 6d4b96567..b6675a1c3 100644 --- a/autobahn/twisted/component.py +++ b/autobahn/twisted/component.py @@ -329,7 +329,7 @@ def start(self, reactor=None): "done" or with a Failure if something went wrong. """ if reactor is None: - self.log.warn("Using default reactor") + self.log.warning("Using default reactor") from twisted.internet import reactor return self._start(loop=reactor) @@ -370,7 +370,7 @@ def done_callback(reactor, arg): if isinstance(arg, Failure): log.error('Something went wrong: {log_failure}', failure=arg) try: - log.warn('Stopping reactor ..') + log.warning('Stopping reactor ..') reactor.stop() except ReactorNotRunning: pass diff --git a/autobahn/twisted/rawsocket.py b/autobahn/twisted/rawsocket.py index ff9127e92..819d5aacd 100644 --- a/autobahn/twisted/rawsocket.py +++ b/autobahn/twisted/rawsocket.py @@ -130,11 +130,12 @@ def _on_handshake_complete(self): res = self._session.onOpen(self) except Exception as e: # Exceptions raised in onOpen are fatal .. - self.log.warn("{klass}._on_handshake_complete(): ApplicationSession constructor / onOpen raised ({err})", - klass=self.__class__.__name__, err=e) + self.log.warning("{klass}._on_handshake_complete(): ApplicationSession constructor / onOpen raised ({err})", + klass=self.__class__.__name__, err=e) self.abort() else: - self.log.debug('{klass}._on_handshake_complete(): {session} started (res={res}).', klass=self.__class__.__name__, + self.log.debug('{klass}._on_handshake_complete(): {session} started (res={res}).', + klass=self.__class__.__name__, session=self._session, res=res) def connectionLost(self, reason): @@ -146,8 +147,8 @@ def connectionLost(self, reason): self._session.onClose(wasClean) except Exception as e: # silently ignore exceptions raised here .. - self.log.warn('{klass}.connectionLost(): ApplicationSession.onClose raised "{err}"', - klass=self.__class__.__name__, err=e) + self.log.warning('{klass}.connectionLost(): ApplicationSession.onClose raised "{err}"', + klass=self.__class__.__name__, err=e) self._session = None def stringReceived(self, payload): @@ -165,34 +166,34 @@ def stringReceived(self, payload): err=e) except InvalidUriError as e: - self.log.warn("{klass}.stringReceived: WAMP InvalidUriError - aborting connection!\n{err}", - klass=self.__class__.__name__, - err=e) + self.log.warning("{klass}.stringReceived: WAMP InvalidUriError - aborting connection!\n{err}", + klass=self.__class__.__name__, + err=e) self.abort() except ProtocolError as e: - self.log.warn("{klass}.stringReceived: WAMP ProtocolError - aborting connection!\n{err}", - klass=self.__class__.__name__, - err=e) + self.log.warning("{klass}.stringReceived: WAMP ProtocolError - aborting connection!\n{err}", + klass=self.__class__.__name__, + err=e) self.abort() except PayloadExceededError as e: - self.log.warn("{klass}.stringReceived: WAMP PayloadExceededError - aborting connection!\n{err}", - klass=self.__class__.__name__, - err=e) + self.log.warning("{klass}.stringReceived: WAMP PayloadExceededError - aborting connection!\n{err}", + klass=self.__class__.__name__, + err=e) self.abort() except SerializationError as e: - self.log.warn("{klass}.stringReceived: WAMP SerializationError - aborting connection!\n{err}", - klass=self.__class__.__name__, - err=e) + self.log.warning("{klass}.stringReceived: WAMP SerializationError - aborting connection!\n{err}", + klass=self.__class__.__name__, + err=e) self.abort() except Exception as e: self.log.failure() - self.log.warn("{klass}.stringReceived: WAMP Exception - aborting connection!\n{err}", - klass=self.__class__.__name__, - err=e) + self.log.warning("{klass}.stringReceived: WAMP Exception - aborting connection!\n{err}", + klass=self.__class__.__name__, + err=e) self.abort() def send(self, msg): @@ -212,7 +213,7 @@ def send(self, msg): if 0 < self._max_len_send < payload_len: emsg = 'tried to send RawSocket message with size {} exceeding payload limit of {} octets'.format( payload_len, self._max_len_send) - self.log.warn(emsg) + self.log.warning(emsg) raise PayloadExceededError(emsg) else: self.sendString(payload) @@ -279,7 +280,7 @@ def dataReceived(self, data): # _magic = ord(self._handshake_bytes[0:1]) if _magic != 127: - self.log.warn( + self.log.warning( "WampRawSocketServerProtocol: invalid magic byte (octet 1) in" " opening handshake: was {magic}, but expected 127", magic=_magic, @@ -306,7 +307,7 @@ def dataReceived(self, data): serializer=ser_id, ) else: - self.log.warn( + self.log.warning( "WampRawSocketServerProtocol: opening handshake - no suitable serializer found (client requested {serializer}, and we have {serializers}", serializer=ser_id, serializers=self.factory._serializers.keys(), diff --git a/autobahn/wamp/component.py b/autobahn/wamp/component.py index 5da892d32..b5113d291 100644 --- a/autobahn/wamp/component.py +++ b/autobahn/wamp/component.py @@ -706,7 +706,7 @@ def transport_check(_): break delay = transport.next_delay() - self.log.warn( + self.log.warning( 'trying transport {transport_idx} ("{transport_url}") using connect delay {transport_delay}', transport_idx=transport.idx, transport_url=transport.url, @@ -831,7 +831,7 @@ def on_disconnect(session, was_clean): ) if not txaio.is_called(done): if not was_clean: - self.log.warn( + self.log.warning( "Session disconnected uncleanly" ) else: diff --git a/autobahn/wamp/protocol.py b/autobahn/wamp/protocol.py index 20028d2ce..9f7e5ec47 100644 --- a/autobahn/wamp/protocol.py +++ b/autobahn/wamp/protocol.py @@ -272,14 +272,14 @@ def _exception_from_message(self, msg): if not self._payload_codec: log_msg = "received encoded payload, but no payload codec active" - self.log.warn(log_msg) + self.log.warning(log_msg) enc_err = ApplicationError(ApplicationError.ENC_NO_PAYLOAD_CODEC, log_msg, enc_algo=msg.enc_algo) else: try: encoded_payload = EncodedPayload(msg.payload, msg.enc_algo, msg.enc_serializer, msg.enc_key) decrypted_error, msg.args, msg.kwargs = self._payload_codec.decode(True, msg.error, encoded_payload) except Exception as e: - self.log.warn("failed to decrypt application payload 1: {err}", err=e) + self.log.warning("failed to decrypt application payload 1: {err}", err=e) enc_err = ApplicationError( ApplicationError.ENC_DECRYPT_ERROR, "failed to decrypt application payload 1: {}".format(e), @@ -287,7 +287,7 @@ def _exception_from_message(self, msg): ) else: if msg.error != decrypted_error: - self.log.warn( + self.log.warning( "URI within encrypted payload ('{decrypted_error}') does not match the envelope ('{error}')", decrypted_error=decrypted_error, error=msg.error, @@ -496,9 +496,9 @@ def onUserError(self, fail, msg): Implements :func:`autobahn.wamp.interfaces.ISession.onUserError` """ if hasattr(fail, 'value') and isinstance(fail.value, exception.ApplicationError): - self.log.warn('{klass}.onUserError(): "{msg}"', - klass=self.__class__.__name__, - msg=fail.value.error_message()) + self.log.warning('{klass}.onUserError(): "{msg}"', + klass=self.__class__.__name__, + msg=fail.value.error_message()) else: self.log.error( '{klass}.onUserError(): "{msg}"\n{traceback}', @@ -750,18 +750,18 @@ def _error(e): if msg.enc_algo: # FIXME: behavior in error cases (no keyring, decrypt issues, URI mismatch, ..) if not self._payload_codec: - self.log.warn("received encoded payload with enc_algo={enc_algo}, but no payload codec active - ignoring encoded payload!", enc_algo=msg.enc_algo) + self.log.warning("received encoded payload with enc_algo={enc_algo}, but no payload codec active - ignoring encoded payload!", enc_algo=msg.enc_algo) return else: try: encoded_payload = EncodedPayload(msg.payload, msg.enc_algo, msg.enc_serializer, msg.enc_key) decoded_topic, msg.args, msg.kwargs = self._payload_codec.decode(False, topic, encoded_payload) except Exception as e: - self.log.warn("failed to decode application payload encoded with enc_algo={enc_algo}: {error}", error=e, enc_algo=msg.enc_algo) + self.log.warning("failed to decode application payload encoded with enc_algo={enc_algo}: {error}", error=e, enc_algo=msg.enc_algo) return else: if topic != decoded_topic: - self.log.warn("envelope topic URI does not match encoded one") + self.log.warning("envelope topic URI does not match encoded one") return invoke_args = (handler.obj,) if handler.obj else tuple() @@ -781,7 +781,7 @@ def _success(_): response = message.EventReceived(msg.publication) self._transport.send(response) else: - self.log.warn("successfully processed event with acknowledged delivery, but could not send ACK, since the transport was lost in the meantime") + self.log.warning("successfully processed event with acknowledged delivery, but could not send ACK, since the transport was lost in the meantime") def _error(e): errmsg = 'While firing {0} subscribed under {1}.'.format( @@ -869,14 +869,14 @@ def _error(e): if not self._payload_codec: log_msg = "received encoded payload, but no payload codec active" - self.log.warn(log_msg) + self.log.warning(log_msg) enc_err = ApplicationError(ApplicationError.ENC_NO_PAYLOAD_CODEC, log_msg) else: try: encoded_payload = EncodedPayload(msg.payload, msg.enc_algo, msg.enc_serializer, msg.enc_key) decrypted_proc, msg.args, msg.kwargs = self._payload_codec.decode(True, proc, encoded_payload) except Exception as e: - self.log.warn( + self.log.warning( "failed to decrypt application payload 1: {err}", err=e, ) @@ -886,7 +886,7 @@ def _error(e): ) else: if proc != decrypted_proc: - self.log.warn( + self.log.warning( "URI within encrypted payload ('{decrypted_proc}') does not match the envelope ('{proc}')", decrypted_proc=decrypted_proc, proc=proc, @@ -989,14 +989,14 @@ def _error(fail): if msg.enc_algo: if not self._payload_codec: log_msg = "received encrypted INVOCATION payload, but no keyring active" - self.log.warn(log_msg) + self.log.warning(log_msg) enc_err = ApplicationError(ApplicationError.ENC_NO_PAYLOAD_CODEC, log_msg) else: try: encoded_payload = EncodedPayload(msg.payload, msg.enc_algo, msg.enc_serializer, msg.enc_key) decrypted_proc, msg.args, msg.kwargs = self._payload_codec.decode(False, proc, encoded_payload) except Exception as e: - self.log.warn( + self.log.warning( "failed to decrypt INVOCATION payload: {err}", err=e, ) @@ -1006,7 +1006,7 @@ def _error(fail): ) else: if proc != decrypted_proc: - self.log.warn( + self.log.warning( "URI within encrypted INVOCATION payload ('{decrypted_proc}') " "does not match the envelope ('{proc}')", decrypted_proc=decrypted_proc, @@ -1084,7 +1084,7 @@ def success(res): if msg.enc_algo: if not self._payload_codec: log_msg = "trying to send encrypted payload, but no keyring active" - self.log.warn(log_msg) + self.log.warning(log_msg) else: try: if isinstance(res, types.CallResult): @@ -1092,7 +1092,7 @@ def success(res): else: encoded_payload = self._payload_codec.encode(False, proc, [res]) except Exception as e: - self.log.warn( + self.log.warning( "failed to encrypt application payload: {err}", err=e, ) @@ -1405,7 +1405,7 @@ def onLeave(self, details: CloseDetails): Implements :meth:`autobahn.wamp.interfaces.ISession.onLeave` """ if details.reason != CloseDetails.REASON_DEFAULT: - self.log.warn('session closed with reason {reason} [{message}]', reason=details.reason, message=details.message) + self.log.warning('session closed with reason {reason} [{message}]', reason=details.reason, message=details.message) # fire ApplicationError on any currently outstanding requests exc = ApplicationError(details.reason, details.message) @@ -1423,7 +1423,7 @@ def leave(self, reason: Optional[str] = None, message: Optional[str] = None): Implements :meth:`autobahn.wamp.interfaces.ISession.leave` """ if not self._session_id: - self.log.warn('session is not joined on a realm - no session to leave') + self.log.warning('session is not joined on a realm - no session to leave') return if not self._goodbye_sent: @@ -1433,7 +1433,7 @@ def leave(self, reason: Optional[str] = None, message: Optional[str] = None): self._transport.send(msg) self._goodbye_sent = True else: - self.log.warn('session was already requested to leave - not sending GOODBYE again') + self.log.warning('session was already requested to leave - not sending GOODBYE again') is_closed = self._transport is None or self._transport.is_closed diff --git a/autobahn/websocket/protocol.py b/autobahn/websocket/protocol.py index c4ef43f88..9d9e2220a 100755 --- a/autobahn/websocket/protocol.py +++ b/autobahn/websocket/protocol.py @@ -890,7 +890,7 @@ def dropConnection(self, abort=False): if self.wasClean: self.log.debug('dropping connection to peer {peer} with abort={abort}', peer=self.peer, abort=abort) else: - self.log.warn('dropping connection to peer {peer} with abort={abort}: {reason}', peer=self.peer, abort=abort, reason=self.wasNotCleanReason) + self.log.warning('dropping connection to peer {peer} with abort={abort}: {reason}', peer=self.peer, abort=abort, reason=self.wasNotCleanReason) self.droppedByMe = True @@ -916,7 +916,7 @@ def _fail_connection(self, code=CLOSE_STATUS_CODE_GOING_AWAY, reason='going away Fails the WebSocket connection. """ if self.state != WebSocketProtocol.STATE_CLOSED: - self.log.warn('failing WebSocket connection (code={code}): "{reason}"', code=code, reason=reason) + self.log.warning('failing WebSocket connection (code={code}): "{reason}"', code=code, reason=reason) self.failedByMe = True @@ -1809,9 +1809,9 @@ def processControlFrame(self): self._sendAutoPing, ) else: - self.log.warn("Auto ping/pong: received non-pending pong") + self.log.warning("Auto ping/pong: received non-pending pong") except: - self.log.warn("Auto ping/pong: received non-pending pong") + self.log.warning("Auto ping/pong: received non-pending pong") # fire app-level callback # @@ -2312,7 +2312,7 @@ def sendMessage(self, if 0 < self.maxMessagePayloadSize < payload_len: self.wasMaxMessagePayloadSizeExceeded = True emsg = 'tried to send WebSocket message with size {} exceeding payload limit of {} octets'.format(payload_len, self.maxMessagePayloadSize) - self.log.warn(emsg) + self.log.warning(emsg) raise PayloadExceededError(emsg) # explicit fragmentSize arguments overrides autoFragmentSize setting @@ -2914,8 +2914,8 @@ def forward_error(err): self.failHandshake(err.value.reason, err.value.code) else: # the user handler ran into an unexpected error (and hence, user code needs fixing!) - self.log.warn("Unexpected exception in onConnect ['{err.value}']", err=err) - self.log.warn("{tb}", tb=txaio.failure_format_traceback(err)) + self.log.warning("Unexpected exception in onConnect ['{err.value}']", err=err) + self.log.warning("{tb}", tb=txaio.failure_format_traceback(err)) return self.failHandshake("Internal server error: {}".format(err.value), ConnectionDeny.INTERNAL_SERVER_ERROR) txaio.add_callbacks(f, self.succeedHandshake, forward_error) diff --git a/autobahn/xbr/_blockchain.py b/autobahn/xbr/_blockchain.py index 2d9d04a06..33f7c6ccd 100644 --- a/autobahn/xbr/_blockchain.py +++ b/autobahn/xbr/_blockchain.py @@ -76,7 +76,7 @@ def start(self): # check we are connected, and check network ID if not w3.isConnected(): emsg = 'could not connect to Web3/Ethereum at: {}'.format(self._gateway or 'auto') - self.log.warn(emsg) + self.log.warning(emsg) raise RuntimeError(emsg) else: print('connected to network {} at provider "{}"'.format(w3.version.network, diff --git a/autobahn/xbr/_buyer.py b/autobahn/xbr/_buyer.py index fdd324bff..621b7e084 100644 --- a/autobahn/xbr/_buyer.py +++ b/autobahn/xbr/_buyer.py @@ -436,10 +436,10 @@ async def unwrap(self, key_id, serializer, ciphertext): marketmaker_channel_seq, marketmaker_remaining, False, marketmaker_signature) if signer_address != self._market_maker_adr: - self.log.warn('{klass}.unwrap()::XBRSIG[8/8] - EIP712 signature invalid: signer_address={signer_address}, delegate_adr={delegate_adr}', - klass=self.__class__.__name__, - signer_address=hl(binascii.b2a_hex(signer_address).decode()), - delegate_adr=hl(binascii.b2a_hex(self._market_maker_adr).decode())) + self.log.warning('{klass}.unwrap()::XBRSIG[8/8] - EIP712 signature invalid: signer_address={signer_address}, delegate_adr={delegate_adr}', + klass=self.__class__.__name__, + signer_address=hl(binascii.b2a_hex(signer_address).decode()), + delegate_adr=hl(binascii.b2a_hex(self._market_maker_adr).decode())) raise ApplicationError('xbr.error.invalid_signature', '{}.unwrap()::XBRSIG[8/8] - EIP712 signature invalid or not signed by market maker'.format(self.__class__.__name__)) diff --git a/autobahn/xbr/_cli.py b/autobahn/xbr/_cli.py index 0fcb86930..894294779 100644 --- a/autobahn/xbr/_cli.py +++ b/autobahn/xbr/_cli.py @@ -353,8 +353,8 @@ async def _do_get_member(self, member_adr): member_adr=hlval(member_data['address'])) return member_data else: - self.log.warn('Address 0x{member_adr} is not a member in the XBR network', - member_adr=hlval(binascii.b2a_hex(member_adr).decode())) + self.log.warning('Address 0x{member_adr} is not a member in the XBR network', + member_adr=hlval(binascii.b2a_hex(member_adr).decode())) async def _do_get_actor(self, market_oid, actor_adr): is_member = await self.call('xbr.network.is_member', actor_adr) @@ -408,8 +408,8 @@ async def _do_get_actor(self, market_oid, actor_adr): else: self.log.info('Member is not yet actor in any market!') else: - self.log.warn('Address 0x{member_adr} is not a member in the XBR network', - member_adr=binascii.b2a_hex(actor_adr).decode()) + self.log.warning('Address 0x{member_adr} is not a member in the XBR network', + member_adr=binascii.b2a_hex(actor_adr).decode()) @inlineCallbacks def _do_onboard_member(self, member_username, member_email, member_password=None): @@ -654,7 +654,7 @@ async def _do_get_market(self, member_oid, market_oid): self.log.info('Market {market_oid} information:\n\n{market}\n', market_oid=hlid(market_oid), market=pformat(market)) else: - self.log.warn('No market {market_oid} found!', market_oid=hlid(market_oid)) + self.log.warning('No market {market_oid} found!', market_oid=hlid(market_oid)) async def _do_join_market(self, member_oid, market_oid, actor_type): diff --git a/autobahn/xbr/_gui.py b/autobahn/xbr/_gui.py index 6ca565bda..754279ad1 100644 --- a/autobahn/xbr/_gui.py +++ b/autobahn/xbr/_gui.py @@ -847,7 +847,7 @@ def get_status(self): status = yield self.call('xbr.network.get_status') return {'config': config, 'status': status} else: - self.log.warn('not connected: could not retrieve status') + self.log.warning('not connected: could not retrieve status') @inlineCallbacks def get_member(self, ethadr_raw): @@ -886,11 +886,11 @@ def get_member(self, ethadr_raw): return member_data else: - self.log.warn('Address {output_ethadr} is not a member in the XBR network', - output_ethadr=ethadr_raw) + self.log.warning('Address {output_ethadr} is not a member in the XBR network', + output_ethadr=ethadr_raw) else: - self.log.warn('not connected: could not retrieve member data for address {output_ethadr}', - output_ethadr=ethadr_raw) + self.log.warning('not connected: could not retrieve member data for address {output_ethadr}', + output_ethadr=ethadr_raw) class Application(object): diff --git a/autobahn/xbr/_seller.py b/autobahn/xbr/_seller.py index 8be6e5be3..339ea80f0 100644 --- a/autobahn/xbr/_seller.py +++ b/autobahn/xbr/_seller.py @@ -345,18 +345,18 @@ async def on_rotate(key_series): except ApplicationError as e: if e.error == 'wamp.error.no_such_procedure': - self.log.warn('xbr.marketmaker.offer: procedure unavailable!') + self.log.warning('xbr.marketmaker.offer: procedure unavailable!') else: self.log.failure() break except TransportLost: - self.log.warn('TransportLost while calling xbr.marketmaker.offer!') + self.log.warning('TransportLost while calling xbr.marketmaker.offer!') break except: self.log.failure() retries -= 1 - self.log.warn('Failed to place offer for key! Retrying {retries}/5 ..', retries=retries) + self.log.warning('Failed to place offer for key! Retrying {retries}/5 ..', retries=retries) await asyncio.sleep(1) key_series = self.KeySeries(api_id, price, interval=interval, count=count, on_rotate=on_rotate) @@ -547,10 +547,10 @@ def close_channel(self, market_maker_adr, channel_oid, channel_seq, channel_bala # XBRSIG: check the signature (over all input data for the buying of the key) signer_address = recover_eip712_channel_close(channel_oid, channel_seq, channel_balance, channel_is_final, marketmaker_signature) if signer_address != market_maker_adr: - self.log.warn('{klass}.sell()::XBRSIG[4/8] - EIP712 signature invalid: signer_address={signer_address}, delegate_adr={delegate_adr}', - klass=self.__class__.__name__, - signer_address=hl(binascii.b2a_hex(signer_address).decode()), - delegate_adr=hl(binascii.b2a_hex(market_maker_adr).decode())) + self.log.warning('{klass}.sell()::XBRSIG[4/8] - EIP712 signature invalid: signer_address={signer_address}, delegate_adr={delegate_adr}', + klass=self.__class__.__name__, + signer_address=hl(binascii.b2a_hex(signer_address).decode()), + delegate_adr=hl(binascii.b2a_hex(market_maker_adr).decode())) raise ApplicationError('xbr.error.invalid_signature', '{}.sell()::XBRSIG[4/8] - EIP712 signature invalid or not signed by market maker'.format(self.__class__.__name__)) # XBRSIG: compute EIP712 typed data signature @@ -663,10 +663,10 @@ def sell(self, market_maker_adr, buyer_pubkey, key_id, channel_oid, channel_seq, signer_address = recover_eip712_channel_close(verifying_chain_id, verifying_contract_adr, current_block_number, market_oid, channel_oid, channel_seq, balance, False, signature) if signer_address != market_maker_adr: - self.log.warn('{klass}.sell()::XBRSIG[4/8] - EIP712 signature invalid: signer_address={signer_address}, delegate_adr={delegate_adr}', - klass=self.__class__.__name__, - signer_address=hl(binascii.b2a_hex(signer_address).decode()), - delegate_adr=hl(binascii.b2a_hex(market_maker_adr).decode())) + self.log.warning('{klass}.sell()::XBRSIG[4/8] - EIP712 signature invalid: signer_address={signer_address}, delegate_adr={delegate_adr}', + klass=self.__class__.__name__, + signer_address=hl(binascii.b2a_hex(signer_address).decode()), + delegate_adr=hl(binascii.b2a_hex(market_maker_adr).decode())) raise ApplicationError('xbr.error.invalid_signature', '{}.sell()::XBRSIG[4/8] - EIP712 signature invalid or not signed by market maker'.format(self.__class__.__name__)) # now actually update our local knowledge of the channel state