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
This commit is contained in:
Chaozhe.Chen 2016-02-22 18:10:26 +08:00
parent 2f3be6eb07
commit cf26592376

View File

@ -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)