From cf26592376eaeba50d3f4640b35dc6f42d792e72 Mon Sep 17 00:00:00 2001 From: "Chaozhe.Chen" Date: Mon, 22 Feb 2016 18:10:26 +0800 Subject: [PATCH] Remove usage of WritableLogger from oslo_log With Eventlet 0.17.2, we can directly pass the logger instance. This allows us to deprecate/remove the WritableLogger class from oslo.log. So there is no need to maintain class `WritableLogger` in our code. Change-Id: Ibeedb65ebfb0cd8bc0ffe24069b390931d8dfe4b Closes-Bug: #1440773 --- heat/common/wsgi.py | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/heat/common/wsgi.py b/heat/common/wsgi.py index e185201fc..885630407 100644 --- a/heat/common/wsgi.py +++ b/heat/common/wsgi.py @@ -255,24 +255,12 @@ def get_socket(conf, default_port): return sock -class WritableLogger(object): - """A thin wrapper that responds to `write` and logs.""" - - def __init__(self, LOG, level=logging.DEBUG): - self.LOG = LOG - self.level = level - - def write(self, msg): - self.LOG.log(self.level, msg.rstrip("\n")) - - class Server(object): """Server class to manage multiple WSGI sockets and applications.""" def __init__(self, name, conf, threads=1000): os.umask(0o27) # ensure files are created with the correct privileges self._logger = logging.getLogger("eventlet.wsgi.server") - self._wsgi_logger = WritableLogger(self._logger) self.name = name self.threads = threads self.children = set() @@ -545,7 +533,7 @@ class Server(object): self.application, custom_pool=self.pool, url_length_limit=URL_LENGTH_LIMIT, - log=self._wsgi_logger, + log=self._logger, debug=cfg.CONF.debug, keepalive=cfg.CONF.eventlet_opts.wsgi_keep_alive, socket_timeout=socket_timeout) @@ -560,7 +548,7 @@ class Server(object): eventlet.wsgi.server(sock, application, custom_pool=self.pool, url_length_limit=URL_LENGTH_LIMIT, - log=self._wsgi_logger, + log=self._logger, debug=cfg.CONF.debug)