Skip to content

Commit a05d9fd

Browse files
author
Akihiro Motoki
committed
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
1 parent 258c110 commit a05d9fd

1 file changed

Lines changed: 0 additions & 27 deletions

File tree

openstackclient/common/utils.py

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -26,33 +26,6 @@
2626
from openstackclient.common import exceptions
2727

2828

29-
class log_method(object):
30-
31-
def __init__(self, log=None, level=logging.DEBUG):
32-
self._log = log
33-
self._level = level
34-
35-
def __call__(self, func):
36-
func_name = func.__name__
37-
if not self._log:
38-
self._log = logging.getLogger(func.__class__.__name__)
39-
40-
@six.wraps(func)
41-
def wrapper(*args, **kwargs):
42-
if self._log.isEnabledFor(self._level):
43-
pretty_args = []
44-
if args:
45-
pretty_args.extend(str(a) for a in args)
46-
if kwargs:
47-
pretty_args.extend(
48-
"%s=%s" % (k, v) for k, v in six.iteritems(kwargs))
49-
self._log.log(self._level, "%s(%s)",
50-
func_name, ", ".join(pretty_args))
51-
return func(*args, **kwargs)
52-
53-
return wrapper
54-
55-
5629
def find_resource(manager, name_or_id, **kwargs):
5730
"""Helper for the _find_* methods.
5831

0 commit comments

Comments
 (0)