mirror of
https://github.com/facebook/sapling.git
synced 2024-10-09 00:14:35 +03:00
commitcloud: add config option that enables logging of requests
Summary: add config option for very verbose output (print the requests) this option is intended for troubleshooting and it can greatly simplify troubleshooting Reviewed By: StanislavGlebik Differential Revision: D7572794 fbshipit-source-id: c0c5cfcc22ebc7799b02abd7bb08dc6a9bc4c6cd
This commit is contained in:
parent
9979530751
commit
e745c7b870
@ -54,6 +54,9 @@
|
||||
|
||||
# update to a new revision if the current revision has been moved
|
||||
updateonmove = true
|
||||
|
||||
# option to print requests to Commit Cloud web endpoint (in debug level)
|
||||
debugrequests = true
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
@ -46,6 +46,9 @@ class HttpsCommitCloudService(baseservice.BaseService):
|
||||
# optional, but needed for using a sandbox
|
||||
self.certs = ui.config('commitcloud', 'certs')
|
||||
|
||||
# debug option
|
||||
self.debugrequests = ui.config('commitcloud', 'debugrequests')
|
||||
|
||||
def getauthparams():
|
||||
oauth = ui.configbool('commitcloud', 'oauth')
|
||||
""" If OAuth authentication is enabled we require
|
||||
@ -120,6 +123,9 @@ class HttpsCommitCloudService(baseservice.BaseService):
|
||||
def _send(self, path, data):
|
||||
e = None
|
||||
rdata = None
|
||||
# print all requests if debugrequests and debug are both on
|
||||
if self.debugrequests:
|
||||
self.ui.debug('%s\n' % json.dumps(data, indent=4))
|
||||
if self._getheader('Content-Encoding') == 'gzip':
|
||||
buffer = util.stringio()
|
||||
with gzip.GzipFile(fileobj=buffer, mode='w') as compressed:
|
||||
|
Loading…
Reference in New Issue
Block a user