Move adapter properties to base class

Move some properties of the adapters to the base class where they can be
shared.

Change-Id: Ie38d0a7d05e7be92c4e0592b7f3cc3c232723df6
This commit is contained in:
Doug Hellmann
2014-09-30 12:11:14 -04:00
parent 434ff356e1
commit f41bc13601

View File

@@ -75,6 +75,12 @@ def _get_log_file_path(conf, binary=None):
class BaseLoggerAdapter(logging.LoggerAdapter):
warn = logging.LoggerAdapter.warning
@property
def handlers(self):
return self.logger.handlers
def audit(self, msg, *args, **kwargs):
self.log(logging.AUDIT, msg, *args, **kwargs)
@@ -110,7 +116,6 @@ class LazyAdapter(BaseLoggerAdapter):
class KeywordArgumentAdapter(BaseLoggerAdapter):
"""Logger adapter to add keyword arguments to log record's extra data
"""
warn = logging.LoggerAdapter.warning
def process(self, msg, kwargs):
# Make a new extra dictionary combining the values we were