Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb9041dd

Browse files
committed
Add AsyncGraphQL.enable_debug
1 parent63b2d91 commitb9041dd

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

‎gitlab/client.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1779,3 +1779,36 @@ def _set_auth_info(self) -> None:
17791779
self._auth=requests.auth.HTTPBasicAuth(
17801780
self.http_username,self.http_password
17811781
)
1782+
1783+
defenable_debug(self,mask_credentials:bool=True)->None:
1784+
importlogging
1785+
fromhttpimportclient
1786+
1787+
client.HTTPConnection.debuglevel=1
1788+
logging.basicConfig()
1789+
logger=logging.getLogger()
1790+
logger.setLevel(logging.DEBUG)
1791+
1792+
httpclient_log=logging.getLogger("http.client")
1793+
httpclient_log.propagate=True
1794+
httpclient_log.setLevel(logging.DEBUG)
1795+
1796+
requests_log=logging.getLogger("requests.packages.urllib3")
1797+
requests_log.setLevel(logging.DEBUG)
1798+
requests_log.propagate=True
1799+
1800+
# shadow http.client prints to log()
1801+
# https://stackoverflow.com/a/16337639
1802+
defprint_as_log(*args:Any)->None:
1803+
httpclient_log.log(logging.DEBUG," ".join(args))
1804+
1805+
setattr(client,"print",print_as_log)
1806+
1807+
ifnotmask_credentials:
1808+
return
1809+
1810+
token=self.private_tokenorself.oauth_tokenorself.job_token
1811+
handler=logging.StreamHandler()
1812+
handler.setFormatter(utils.MaskingFormatter(masked=token))
1813+
logger.handlers.clear()
1814+
logger.addHandler(handler)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp