Fix warning message when RefStack server starts up.
There is a warning message about that WritableLogger() is deprecated in oslo_log when RefStack Server starts up, now move it in-tree. Closes-Bug: #1539344 Change-Id: I8a704ecb61eb4879b340ba77833137a0b546839d
This commit is contained in:
parent
9e2cd56398
commit
df4e7c7913
@ -22,7 +22,6 @@ import os
|
||||
from beaker.middleware import SessionMiddleware
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log
|
||||
from oslo_log import loggers
|
||||
import pecan
|
||||
import six
|
||||
import webob
|
||||
@ -153,6 +152,19 @@ class JSONErrorHook(pecan.hooks.PecanHook):
|
||||
)
|
||||
|
||||
|
||||
class WritableLogger(object):
|
||||
"""A thin wrapper that responds to `write` and logs."""
|
||||
|
||||
def __init__(self, logger, level):
|
||||
"""Init the WritableLogger by getting logger and log level."""
|
||||
self.logger = logger
|
||||
self.level = level
|
||||
|
||||
def write(self, msg):
|
||||
"""Invoke logger with log level and message."""
|
||||
self.logger.log(self.level, msg.rstrip())
|
||||
|
||||
|
||||
class CORSHook(pecan.hooks.PecanHook):
|
||||
"""A pecan hook that handles Cross-Origin Resource Sharing."""
|
||||
|
||||
@ -208,7 +220,7 @@ def setup_app(config):
|
||||
template_path=template_path,
|
||||
hooks=[JSONErrorHook(), CORSHook(), pecan.hooks.RequestViewerHook(
|
||||
{'items': ['status', 'method', 'controller', 'path', 'body']},
|
||||
headers=False, writer=loggers.WritableLogger(LOG, logging.DEBUG)
|
||||
headers=False, writer=WritableLogger(LOG, logging.DEBUG)
|
||||
)]
|
||||
)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user