Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
gajim
python-nbxmpp
Commits
e820dbef
Commit
e820dbef
authored
Mar 21, 2021
by
Philipp Hörist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add logging for method iq_request_task calls
parent
bab56bc1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
0 deletions
+17
-0
nbxmpp/modules/util.py
nbxmpp/modules/util.py
+14
-0
nbxmpp/task.py
nbxmpp/task.py
+3
-0
No files found.
nbxmpp/modules/util.py
View file @
e820dbef
...
...
@@ -15,6 +15,7 @@
# 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
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
)
bound_arguments
.
apply_defaults
()
arg_string
=
''
for
name
,
arg
in
bound_arguments
.
arguments
.
items
():
if
name
==
'self'
:
continue
arg_string
+=
f
'
{
name
}
=
{
arg
}
, '
arg_string
=
arg_string
[:
-
2
]
return
f
'
{
func
.
__name__
}
(
{
arg_string
}
)'
nbxmpp/task.py
View file @
e820dbef
...
...
@@ -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
):
@
wraps
(
func
)
def
func_wrapper
(
self
,
*
args
,
timeout
=
None
,
callback
=
None
,
user_data
=
None
,
**
kwargs
):
if
self
.
_log
.
isEnabledFor
(
logging
.
INFO
):
self
.
_log
.
info
(
make_func_arguments_string
(
func
,
self
,
args
,
kwargs
))
task
=
IqRequestTask
(
func
(
self
,
*
args
,
**
kwargs
),
self
.
_log
,
self
.
_client
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment