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

Add logging for method iq_request_task calls

parent bab56bc1
......@@ -15,6 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with this program; If not, see <>.
import inspect
from urllib.parse import urlparse
from urllib.parse import unquote
......@@ -61,3 +62,16 @@ def parse_xmpp_uri(uri):
dict_[key] = unquote(value)
return (url.path, action, dict_)
def make_func_arguments_string(func, self, args, kwargs):
signature = inspect.signature(func)
bound_arguments = signature.bind(self, *args, **kwargs)
arg_string = ''
for name, arg in bound_arguments.arguments.items():
if name == 'self':
arg_string += f'{name}={arg}, '
arg_string = arg_string[:-2]
return f'{func.__name__}({arg_string})'
......@@ -27,6 +27,7 @@ from nbxmpp.errors import is_error
from nbxmpp.errors import CancelledError
from nbxmpp.errors import TimeoutStanzaError
from nbxmpp.simplexml import Node
from nbxmpp.modules.util import make_func_arguments_string
log = logging.getLogger('nbxmpp.task')
......@@ -78,6 +79,8 @@ def _setup_task(task, client, callback, user_data):
def iq_request_task(func):
def func_wrapper(self, *args, timeout=None, callback=None, user_data=None, **kwargs):
if self._log.isEnabledFor(logging.INFO):, self, args, kwargs))
task = IqRequestTask(func(self, *args, **kwargs),
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