Use loggers rather then the logging module directly

Refs django/channels#846
This commit is contained in:
Andrew Godwin 2018-02-02 20:07:39 -08:00
parent 990656a36d
commit 3b2fb6f78e
2 changed files with 3 additions and 3 deletions

View File

@ -221,7 +221,7 @@ class WebRequest(http.Request):
"size": self.sentLength, "size": self.sentLength,
}) })
except Exception as e: except Exception as e:
logging.error(traceback.format_exc()) logger.error(traceback.format_exc())
else: else:
logger.debug("HTTP response chunk for %s", self.client_addr) logger.debug("HTTP response chunk for %s", self.client_addr)
else: else:

View File

@ -189,7 +189,7 @@ class Server(object):
# Protocol is asking the server to exit (likely during test) # Protocol is asking the server to exit (likely during test)
self.stop() self.stop()
else: else:
logging.error( logger.error(
"Exception inside application: {}\n{}{}".format( "Exception inside application: {}\n{}{}".format(
exception, exception,
"".join(traceback.format_tb( "".join(traceback.format_tb(
@ -216,7 +216,7 @@ class Server(object):
if not application_instance.done(): if not application_instance.done():
application_instance.cancel() application_instance.cancel()
wait_for.append(application_instance) wait_for.append(application_instance)
logging.info("Killed %i pending application instances", len(wait_for)) logger.info("Killed %i pending application instances", len(wait_for))
# Make Twisted wait until they're all dead # Make Twisted wait until they're all dead
wait_deferred = defer.Deferred.fromFuture(asyncio.gather(*wait_for)) wait_deferred = defer.Deferred.fromFuture(asyncio.gather(*wait_for))
wait_deferred.addErrback(lambda x: None) wait_deferred.addErrback(lambda x: None)