def log_method(log, level=logging.DEBUG):
def decorator(func):<EOL><INDENT>func_name = func.__name__<EOL>@six.wraps(func)<EOL>def wrapper(self, *args, **kwargs):<EOL><INDENT>if log.isEnabledFor(level):<EOL><INDENT>pretty_args = []<EOL>if args:<EOL><INDENT>pretty_args.extend(str(a) for a in args)<EOL><DEDENT>if kwargs:<EOL><INDENT>pretty_args.extend(<EOL>"<STR_LIT>" % (k, v) for k, v in six.iteritems(kwargs))<EOL><DEDENT>log.log(level, "<STR_LIT>", func_name, "<STR_LIT:U+002CU+0020>".join(pretty_args))<EOL><DEDENT>return func(self, *args, **kwargs)<EOL><DEDENT>return wrapper<EOL><DEDENT>return decorator<EOL>
Logs a method and its arguments when entered.