diff options
| author | Rapptz <[email protected]> | 2017-06-09 18:53:24 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2017-06-09 18:53:24 -0400 |
| commit | b06899e7d4658ab732d1579283771f709a7a4bce (patch) | |
| tree | 39c3018e9e7f62711d78f607939346f5d4075deb /discord/gateway.py | |
| parent | Implement "partial" message events. (diff) | |
| download | discord.py-b06899e7d4658ab732d1579283771f709a7a4bce.tar.xz discord.py-b06899e7d4658ab732d1579283771f709a7a4bce.zip | |
Defer logging formatting until the logger is actually called.
This would cause unnecessary format calls even if you didn't have
logging enabled.
Diffstat (limited to 'discord/gateway.py')
| -rw-r--r-- | discord/gateway.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/discord/gateway.py b/discord/gateway.py index 8cc13f04..c8dc08a3 100644 --- a/discord/gateway.py +++ b/discord/gateway.py @@ -205,7 +205,7 @@ class DiscordWebSocket(websockets.client.WebSocketClientProtocol): client._connection._update_references(ws) - log.info('Created websocket connected to {}'.format(gateway)) + log.info('Created websocket connected to %s', gateway) # poll event for OP Hello yield from ws.poll_event() @@ -425,10 +425,10 @@ class DiscordWebSocket(websockets.client.WebSocketClientProtocol): yield from self.received_message(msg) except websockets.exceptions.ConnectionClosed as e: if self._can_handle_close(e.code): - log.info('Websocket closed with {0.code} ({0.reason}), attempting a reconnect.'.format(e)) + log.info('Websocket closed with %s (%s), attempting a reconnect.', e.code, e.reason) raise ResumeWebSocket(self.shard_id) from e else: - log.info('Websocket closed with {0.code} ({0.reason}), cannot reconnect.'.format(e)) + log.info('Websocket closed with %s (%s), cannot reconnect.', e.code, e.reason) raise ConnectionClosed(e, shard_id=self.shard_id) from e @asyncio.coroutine @@ -646,7 +646,7 @@ class DiscordVoiceWebSocket(websockets.client.WebSocketClientProtocol): struct.pack_into('>I', packet, 0, state.ssrc) state.socket.sendto(packet, (state.endpoint_ip, state.voice_port)) recv = yield from self.loop.sock_recv(state.socket, 70) - log.debug('received packet in initial_connection: {}'.format(recv)) + log.debug('received packet in initial_connection: %s', recv) # the ip is ascii starting at the 4th byte and ending at the first null ip_start = 4 @@ -657,7 +657,7 @@ class DiscordVoiceWebSocket(websockets.client.WebSocketClientProtocol): # yes, this is different endianness from everything else state.port = struct.unpack_from('<H', recv, len(recv) - 2)[0] - log.debug('detected ip: {0.ip} port: {0.port}'.format(state)) + log.debug('detected ip: %s port: %s', state.ip, state.port) yield from self.select_protocol(state.ip, state.port) log.info('selected the voice protocol for use') |