Merge "Drop log_method decorator"

This commit is contained in:
Jenkins 2016-02-02 21:21:30 +00:00 committed by Gerrit Code Review
commit 4b2c66447d

View File

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