From f41bc136013538c8b8e57055dafe991288641f4a Mon Sep 17 00:00:00 2001 From: Doug Hellmann Date: Tue, 30 Sep 2014 12:11:14 -0400 Subject: [PATCH] Move adapter properties to base class Move some properties of the adapters to the base class where they can be shared. Change-Id: Ie38d0a7d05e7be92c4e0592b7f3cc3c232723df6 --- oslo/log/log.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/oslo/log/log.py b/oslo/log/log.py index 5e0a3a32..4cbbc326 100644 --- a/oslo/log/log.py +++ b/oslo/log/log.py @@ -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