reduce logging
This commit is contained in:
parent
bc822eebef
commit
a19962fb02
@ -36,7 +36,6 @@ class KlippyRest:
|
|||||||
def _do_request(self, method, request_method, data=None, json=None, json_response=True, timeout=3):
|
def _do_request(self, method, request_method, data=None, json=None, json_response=True, timeout=3):
|
||||||
url = f"{self.endpoint}/{method}"
|
url = f"{self.endpoint}/{method}"
|
||||||
headers = {"x-api-key": self.api_key} if self.api_key else {}
|
headers = {"x-api-key": self.api_key} if self.api_key else {}
|
||||||
logging.debug(f"Sending {request_method} to {url}")
|
|
||||||
try:
|
try:
|
||||||
callee = getattr(requests, request_method)
|
callee = getattr(requests, request_method)
|
||||||
response = callee(url, json=json, data=data, headers=headers, timeout=timeout)
|
response = callee(url, json=json, data=data, headers=headers, timeout=timeout)
|
||||||
|
@ -214,7 +214,6 @@ class MoonrakerApi:
|
|||||||
|
|
||||||
def object_subscription(self, updates):
|
def object_subscription(self, updates):
|
||||||
logging.debug("Sending printer.objects.subscribe")
|
logging.debug("Sending printer.objects.subscribe")
|
||||||
logging.debug(updates)
|
|
||||||
return self._ws.send_method(
|
return self._ws.send_method(
|
||||||
"printer.objects.subscribe",
|
"printer.objects.subscribe",
|
||||||
updates
|
updates
|
||||||
|
@ -52,7 +52,7 @@ class KlipperScreenConfig:
|
|||||||
self.config.read(self.default_config_path)
|
self.config.read(self.default_config_path)
|
||||||
includes = [i[8:] for i in self.config.sections() if i.startswith("include ")]
|
includes = [i[8:] for i in self.config.sections() if i.startswith("include ")]
|
||||||
for include in includes:
|
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
|
# In case a user altered defaults.conf
|
||||||
self.validate_config(self.config)
|
self.validate_config(self.config)
|
||||||
if self.config_path != self.default_config_path:
|
if self.config_path != self.default_config_path:
|
||||||
@ -384,7 +384,7 @@ class KlipperScreenConfig:
|
|||||||
if k.startswith(i):
|
if k.startswith(i):
|
||||||
del self.config[k]
|
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}"
|
full_path = filepath if filepath[0] == "/" else f"{directory}/{filepath}"
|
||||||
parse_files = []
|
parse_files = []
|
||||||
|
|
||||||
@ -392,7 +392,7 @@ class KlipperScreenConfig:
|
|||||||
parent_dir = "/".join(full_path.split("/")[:-1])
|
parent_dir = "/".join(full_path.split("/")[:-1])
|
||||||
file = full_path.split("/")[-1]
|
file = full_path.split("/")[-1]
|
||||||
if not os.path.exists(parent_dir):
|
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
|
return
|
||||||
files = os.listdir(parent_dir)
|
files = os.listdir(parent_dir)
|
||||||
regex = f"^{file.replace('*', '.*')}$"
|
regex = f"^{file.replace('*', '.*')}$"
|
||||||
@ -400,7 +400,7 @@ class KlipperScreenConfig:
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
if not os.path.exists(os.path.join(full_path)):
|
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
|
return
|
||||||
parse_files.append(full_path)
|
parse_files.append(full_path)
|
||||||
|
|
||||||
@ -412,7 +412,8 @@ class KlipperScreenConfig:
|
|||||||
for include in includes:
|
for include in includes:
|
||||||
self._include_config("/".join(full_path.split("/")[:-1]), include)
|
self._include_config("/".join(full_path.split("/")[:-1]), include)
|
||||||
self.exclude_from_config(config)
|
self.exclude_from_config(config)
|
||||||
self.log_config(config)
|
if log:
|
||||||
|
self.log_config(config)
|
||||||
with open(file, 'r') as f:
|
with open(file, 'r') as f:
|
||||||
string = f.read()
|
string = f.read()
|
||||||
if self.validate_config(config, string=string):
|
if self.validate_config(config, string=string):
|
||||||
|
@ -106,7 +106,6 @@ class Printer:
|
|||||||
logging.info(f"# Leds: {self.ledcount}")
|
logging.info(f"# Leds: {self.ledcount}")
|
||||||
|
|
||||||
def stop_tempstore_updates(self):
|
def stop_tempstore_updates(self):
|
||||||
logging.info("Stopping tempstore")
|
|
||||||
if self.store_timeout is not None:
|
if self.store_timeout is not None:
|
||||||
GLib.source_remove(self.store_timeout)
|
GLib.source_remove(self.store_timeout)
|
||||||
self.store_timeout = None
|
self.store_timeout = None
|
||||||
|
Loading…
x
Reference in New Issue
Block a user