From cc2395ca04477e79ca078c896fd714b756a4bd33 Mon Sep 17 00:00:00 2001 From: Athanasius Date: Mon, 15 Mar 2021 12:13:28 +0000 Subject: [PATCH] Add similar extra logging for localhost handler * This also adjusts the logging in Session.auth_callback() because it can be called from either protocol. Saying 'edmc://' there is misleading. --- companion.py | 4 ++-- protocol.py | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/companion.py b/companion.py index 43f21721..36fb62cb 100644 --- a/companion.py +++ b/companion.py @@ -437,8 +437,8 @@ class Session(object): # Callback from protocol handler def auth_callback(self) -> None: - """Handle callback from edmc:// handler.""" - logger.debug('Handling callback from edmc:// handler') + """Handle callback from edmc:// or localhost:/auth handler.""" + logger.debug('Handling auth callback') if self.state != Session.STATE_AUTH: # Shouldn't be getting a callback logger.debug('Got an auth callback while not doing auth') diff --git a/protocol.py b/protocol.py index 04e233ef..dcaa8b99 100644 --- a/protocol.py +++ b/protocol.py @@ -36,6 +36,7 @@ class GenericProtocolHandler(object): def event(self, url): self.lastpayload = url + logger.trace(f'Payload: {self.lastpayload}') if not config.shutting_down: logger.debug('event_generate("<>"') self.master.event_generate('<>', when="tail") @@ -247,8 +248,10 @@ else: # Linux / Run from source class HTTPRequestHandler(BaseHTTPRequestHandler): def parse(self): + logger.trace(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()') protocolhandler.event(url) self.send_response(200) return True