From a05d9fd9f13e6e9da031d527a39f7f0628bf69c7 Mon Sep 17 00:00:00 2001 From: Akihiro Motoki <motoki@da.jp.nec.com> Date: Tue, 2 Feb 2016 12:51:24 +0900 Subject: [PATCH] Drop log_method decorator As a result of the recent logging refactoring, log_method decorator is no longer required. oslo.log provides a similar decorator oslo_log.helpers.log_method_call. If a similar feature is needed, we can use the decorator from oslo_log. searchlightclient is the only OSC external plugin which uses this decorator. The depending patch removes it, so we can safely drop the decorator. Change-Id: If3df09cf6aa0a401d9f89e8924adce851d0c6dec Depends-On: Ib94e7ba77262a9a8cbfce71f3083c47cb1973364 --- openstackclient/common/utils.py | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/openstackclient/common/utils.py b/openstackclient/common/utils.py index 3ae30c8f71..1ca2bc574a 100644 --- a/openstackclient/common/utils.py +++ b/openstackclient/common/utils.py @@ -26,33 +26,6 @@ from oslo_utils import importutils from openstackclient.common import exceptions -class log_method(object): - - def __init__(self, log=None, level=logging.DEBUG): - self._log = log - self._level = level - - def __call__(self, func): - func_name = func.__name__ - if not self._log: - self._log = logging.getLogger(func.__class__.__name__) - - @six.wraps(func) - def wrapper(*args, **kwargs): - if self._log.isEnabledFor(self._level): - pretty_args = [] - if args: - pretty_args.extend(str(a) for a in args) - if kwargs: - pretty_args.extend( - "%s=%s" % (k, v) for k, v in six.iteritems(kwargs)) - self._log.log(self._level, "%s(%s)", - func_name, ", ".join(pretty_args)) - return func(*args, **kwargs) - - return wrapper - - def find_resource(manager, name_or_id, **kwargs): """Helper for the _find_* methods.