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

Commit63b2d91

Browse files
committed
Add GraphQL.enable_debug
1 parent09ab656 commit63b2d91

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
@@ -1540,6 +1540,39 @@ def _set_auth_info(self) -> None:
15401540
self.http_username,self.http_password
15411541
)
15421542

1543+
defenable_debug(self,mask_credentials:bool=True)->None:
1544+
importlogging
1545+
fromhttpimportclient
1546+
1547+
client.HTTPConnection.debuglevel=1
1548+
logging.basicConfig()
1549+
logger=logging.getLogger()
1550+
logger.setLevel(logging.DEBUG)
1551+
1552+
httpclient_log=logging.getLogger("http.client")
1553+
httpclient_log.propagate=True
1554+
httpclient_log.setLevel(logging.DEBUG)
1555+
1556+
requests_log=logging.getLogger("requests.packages.urllib3")
1557+
requests_log.setLevel(logging.DEBUG)
1558+
requests_log.propagate=True
1559+
1560+
# shadow http.client prints to log()
1561+
# https://stackoverflow.com/a/16337639
1562+
defprint_as_log(*args:Any)->None:
1563+
httpclient_log.log(logging.DEBUG," ".join(args))
1564+
1565+
setattr(client,"print",print_as_log)
1566+
1567+
ifnotmask_credentials:
1568+
return
1569+
1570+
token=self.private_tokenorself.oauth_tokenorself.job_token
1571+
handler=logging.StreamHandler()
1572+
handler.setFormatter(utils.MaskingFormatter(masked=token))
1573+
logger.handlers.clear()
1574+
logger.addHandler(handler)
1575+
15431576

15441577
classAsyncGraphQL(_BaseGraphQL):
15451578
def__init__(

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp