From 6db6d4b0e0f89206f6309680158b127fe5a5a227 Mon Sep 17 00:00:00 2001 From: Andrew Neisch Date: Sat, 3 Feb 2024 00:57:41 -0600 Subject: [PATCH] Extend logging --- thermostat_api_server.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/thermostat_api_server.py b/thermostat_api_server.py index c9a9d9c..303751f 100755 --- a/thermostat_api_server.py +++ b/thermostat_api_server.py @@ -259,7 +259,8 @@ def on_message(client, userdata, message): candidate_configuration["htsp"] = new_temperature.split(".")[0] class MyHttpRequestHandler(BaseHTTPRequestHandler): - protocol_version = 'HTTP/1.1' + def log_message(self, format, *args): + logging.info(f"{self.address_string()} -- {self.command} -- {self.path}") def send_no_changes(self): html = f'''{datetime.datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%SZ")}001440060864008640086400864000offoffoffoffoffoff''' @@ -276,8 +277,6 @@ def send_empty_200(self): self.end_headers() def do_GET(self): - html = "" - if "/Alive" in self.path: html = "alive" self.send_response(200) @@ -367,7 +366,7 @@ def do_POST(self): self.send_empty_200() elif "/status" in final_locator: - logging.debug(f"{current_configuration}") + logging.debug(f"Current Configuration: {current_configuration}") current_configuration["last_communication"] = datetime.datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%SZ") # Initialize candidate_configuration as current_configuration at first start