reduce logging

This commit is contained in:
Alfredo Monclus 2024-05-25 00:47:59 -03:00
parent bc822eebef
commit a19962fb02
4 changed files with 6 additions and 8 deletions

View File

@ -36,7 +36,6 @@ class KlippyRest:
def _do_request(self, method, request_method, data=None, json=None, json_response=True, timeout=3):
url = f"{self.endpoint}/{method}"
headers = {"x-api-key": self.api_key} if self.api_key else {}
logging.debug(f"Sending {request_method} to {url}")
try:
callee = getattr(requests, request_method)
response = callee(url, json=json, data=data, headers=headers, timeout=timeout)

View File

@ -214,7 +214,6 @@ class MoonrakerApi:
def object_subscription(self, updates):
logging.debug("Sending printer.objects.subscribe")
logging.debug(updates)
return self._ws.send_method(
"printer.objects.subscribe",
updates

View File

@ -52,7 +52,7 @@ class KlipperScreenConfig:
self.config.read(self.default_config_path)
includes = [i[8:] for i in self.config.sections() if i.startswith("include ")]
for include in includes:
self._include_config("/".join(self.default_config_path.split("/")[:-1]), include)
self._include_config("/".join(self.default_config_path.split("/")[:-1]), include, log=False)
# In case a user altered defaults.conf
self.validate_config(self.config)
if self.config_path != self.default_config_path:
@ -384,7 +384,7 @@ class KlipperScreenConfig:
if k.startswith(i):
del self.config[k]
def _include_config(self, directory, filepath):
def _include_config(self, directory, filepath, log=True):
full_path = filepath if filepath[0] == "/" else f"{directory}/{filepath}"
parse_files = []
@ -392,7 +392,7 @@ class KlipperScreenConfig:
parent_dir = "/".join(full_path.split("/")[:-1])
file = full_path.split("/")[-1]
if not os.path.exists(parent_dir):
logging.info(f"Config Error: Directory {parent_dir} does not exist")
logging.error(f"Config Error: Directory {parent_dir} does not exist")
return
files = os.listdir(parent_dir)
regex = f"^{file.replace('*', '.*')}$"
@ -400,7 +400,7 @@ class KlipperScreenConfig:
else:
if not os.path.exists(os.path.join(full_path)):
logging.info(f"Config Error: {full_path} does not exist")
logging.error(f"Config Error: {full_path} does not exist")
return
parse_files.append(full_path)
@ -412,7 +412,8 @@ class KlipperScreenConfig:
for include in includes:
self._include_config("/".join(full_path.split("/")[:-1]), include)
self.exclude_from_config(config)
self.log_config(config)
if log:
self.log_config(config)
with open(file, 'r') as f:
string = f.read()
if self.validate_config(config, string=string):

View File

@ -106,7 +106,6 @@ class Printer:
logging.info(f"# Leds: {self.ledcount}")
def stop_tempstore_updates(self):
logging.info("Stopping tempstore")
if self.store_timeout is not None:
GLib.source_remove(self.store_timeout)
self.store_timeout = None