Commit 0414d956 authored by Philipp Hörist's avatar Philipp Hörist
Browse files

Add log_calls decorator

parent 0c0d9c20
......@@ -15,6 +15,8 @@
# You should have received a copy of the GNU General Public License
# along with this program; If not, see <http://www.gnu.org/licenses/>.
import logging
import functools
import inspect
from urllib.parse import urlparse
from urllib.parse import unquote
......@@ -75,3 +77,12 @@ def make_func_arguments_string(func, self, args, kwargs):
arg_string += f'{name}={arg}, '
arg_string = arg_string[:-2]
return f'{func.__name__}({arg_string})'
def log_calls(func):
@functools.wraps(func)
def func_wrapper(self, *args, **kwargs):
if self._log.isEnabledFor(logging.INFO):
self._log.info(make_func_arguments_string(func, self, args, kwargs))
return func(self, *args, **kwargs)
return func_wrapper
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment