Skip to content

Commit 3048c58

Browse files
zasphw
authored andcommitted
Add a DebugOpt for POST data
POST DATA was logged in debug mode unconditionally, now it can be enabled if needed.
1 parent f57bc89 commit 3048c58

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

picard/debug_opts.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,5 +79,6 @@ def get_registry(cls):
7979

8080

8181
class DebugOpt(DebugOptEnum):
82-
WS_REPLIES = 1, N_('Web Service Replies'), N_('Log content of web service replies')
83-
PLUGIN_FULLPATH = 2, N_('Plugin Fullpath'), N_('Log plugin full paths')
82+
PLUGIN_FULLPATH = 1, N_('Plugin Fullpath'), N_('Log plugin full paths')
83+
WS_POST = 2, N_('Web Service Post Data'), N_('Log data of web service post requests')
84+
WS_REPLIES = 3, N_('Web Service Replies'), N_('Log content of web service replies')

picard/webservice/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,8 @@ def post_url(self, **kwargs):
589589
kwargs['method'] = 'POST'
590590
kwargs['parse_response_type'] = kwargs.get('parse_response_type', DEFAULT_RESPONSE_PARSER_TYPE)
591591
kwargs['mblogin'] = kwargs.get('mblogin', True)
592-
log.debug("POST-DATA %r", kwargs['data'])
592+
if DebugOpt.WS_POST.enabled:
593+
log.debug("POST-DATA %r", kwargs['data'])
593594
return self.add_request(WSRequest(**kwargs))
594595

595596
def put_url(self, **kwargs):

0 commit comments

Comments
 (0)