Defer logging formatting until the logger is actually called.

This would cause unnecessary format calls even if you didn't have
logging enabled.
This commit is contained in:
Rapptz
2017-06-09 18:53:24 -04:00
parent d239cc2666
commit b06899e7d4
6 changed files with 17 additions and 19 deletions

View File

@ -405,7 +405,7 @@ class Client:
raise
retry = backoff.delay()
log.exception("Attempting a reconnect in {:.2f}s".format(retry))
log.exception("Attempting a reconnect in %.2fs", retry)
yield from asyncio.sleep(retry, loop=self.loop)
@asyncio.coroutine
@ -725,7 +725,7 @@ class Client:
raise ClientException('event registered must be a coroutine function')
setattr(self, coro.__name__, coro)
log.info('{0.__name__} has successfully been registered as an event'.format(coro))
log.info('%s has successfully been registered as an event', coro.__name__)
return coro
def async_event(self, coro):