[lint] Do log formating lazily
Convert log("fmt" % args) to log("fmt", args) as the latter is lazy and does not do the formating if the string is never logged.
This commit is contained in:
parent
a0634b3eea
commit
34fd266cf9
@ -70,7 +70,7 @@ class KeepAliveHandler(threading.Thread):
|
|||||||
def run(self):
|
def run(self):
|
||||||
while not self._stop_ev.wait(self.interval):
|
while not self._stop_ev.wait(self.interval):
|
||||||
if self._last_ack + self.heartbeat_timeout < time.perf_counter():
|
if self._last_ack + self.heartbeat_timeout < time.perf_counter():
|
||||||
log.warning("Shard ID %s has stopped responding to the gateway. Closing and restarting." % self.shard_id)
|
log.warning("Shard ID %s has stopped responding to the gateway. Closing and restarting.", self.shard_id)
|
||||||
coro = self.ws.close(4000)
|
coro = self.ws.close(4000)
|
||||||
f = asyncio.run_coroutine_threadsafe(coro, loop=self.ws.loop)
|
f = asyncio.run_coroutine_threadsafe(coro, loop=self.ws.loop)
|
||||||
|
|
||||||
@ -370,7 +370,7 @@ class DiscordWebSocket(websockets.client.WebSocketClientProtocol):
|
|||||||
|
|
||||||
self.sequence = None
|
self.sequence = None
|
||||||
self.session_id = None
|
self.session_id = None
|
||||||
log.info('Shard ID %s session has been invalidated.' % self.shard_id)
|
log.info('Shard ID %s session has been invalidated.', self.shard_id)
|
||||||
await self.identify()
|
await self.identify()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -44,14 +44,14 @@ EncoderStructPtr = ctypes.POINTER(EncoderStruct)
|
|||||||
|
|
||||||
def _err_lt(result, func, args):
|
def _err_lt(result, func, args):
|
||||||
if result < 0:
|
if result < 0:
|
||||||
log.info('error has happened in {0.__name__}'.format(func))
|
log.info('error has happened in %s', func.__name__)
|
||||||
raise OpusError(result)
|
raise OpusError(result)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def _err_ne(result, func, args):
|
def _err_ne(result, func, args):
|
||||||
ret = args[-1]._obj
|
ret = args[-1]._obj
|
||||||
if ret.value != 0:
|
if ret.value != 0:
|
||||||
log.info('error has happened in {0.__name__}'.format(func))
|
log.info('error has happened in %s', func.__name__)
|
||||||
raise OpusError(ret.value)
|
raise OpusError(ret.value)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user