1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-14 00:07:14 +03:00

protocol.py: Use logger.trace_if(...)

This commit is contained in:
Athanasius 2021-08-13 14:48:09 +01:00
parent c8081f339a
commit 305f8ca6b0
No known key found for this signature in database
GPG Key ID: AE3E527847057C7D

View File

@ -48,7 +48,7 @@ class GenericProtocolHandler:
"""Generate an auth event."""
self.lastpayload = url
logger.trace(f'Payload: {self.lastpayload}')
logger.trace_if('frontier-auth', f'Payload: {self.lastpayload}')
if not config.shutting_down:
logger.debug('event_generate("<<CompanionAuthEvent>>")')
self.master.event_generate('<<CompanionAuthEvent>>', when="tail")
@ -298,7 +298,7 @@ elif (config.auth_force_edmc_protocol
msg = MSG()
# Calls GetMessageW: https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getmessagew
while GetMessageW(byref(msg), None, 0, 0) != 0:
logger.trace(f'DDE message of type: {msg.message}')
logger.trace_if('frontier-auth.windows', f'DDE message of type: {msg.message}')
if msg.message == WM_DDE_EXECUTE:
# GlobalLock does some sort of "please dont move this?"
# https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-globallock
@ -306,7 +306,7 @@ elif (config.auth_force_edmc_protocol
GlobalUnlock(msg.lParam) # Unlocks the GlobalLock-ed object
if args.lower().startswith('open("') and args.endswith('")'):
logger.trace(f'args are: {args}')
logger.trace_if('frontier-auth.windows', f'args are: {args}')
url = urllib.parse.unquote(args[6:-2]).strip()
if url.startswith(self.redirect):
logger.debug(f'Message starts with {self.redirect}')
@ -384,7 +384,7 @@ else: # Linux / Run from source
def parse(self) -> bool:
"""Parse a request."""
logger.trace(f'Got message on path: {self.path}')
logger.trace_if('frontier-auth.http', f'Got message on path: {self.path}')
url = urllib.parse.unquote(self.path)
if url.startswith('/auth'):
logger.debug('Request starts with /auth, sending to protocolhandler.event()')