From 0141b5e130395bab95fe4e064e051cefcbae4551 Mon Sep 17 00:00:00 2001 From: Schnello Date: Wed, 13 Mar 2019 12:52:14 +0100 Subject: [PATCH] add log path entry to config --- octoprint_klipper/__init__.py | 3 ++- octoprint_klipper/templates/klipper_settings.jinja2 | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/octoprint_klipper/__init__.py b/octoprint_klipper/__init__.py index dee1431..7beb080 100644 --- a/octoprint_klipper/__init__.py +++ b/octoprint_klipper/__init__.py @@ -73,6 +73,7 @@ class KlipperPlugin( ), configuration = dict( path="~/printer.cfg", + logpath="/tmp/klippy.log", reload_command="RESTART" ) ) @@ -290,7 +291,7 @@ class KlipperPlugin( def on_api_command(self, command, data): if command == "listLogFiles": files = [] - for f in glob.glob("/tmp/*.log*"): + for f in glob.glob(self._settings.get(["configuration", "logpath"]) + "*"): filesize = os.path.getsize(f) files.append(dict( name=os.path.basename(f) + " ({:.1f} KB)".format(filesize / 1000.0), diff --git a/octoprint_klipper/templates/klipper_settings.jinja2 b/octoprint_klipper/templates/klipper_settings.jinja2 index 5b6051d..53c1028 100644 --- a/octoprint_klipper/templates/klipper_settings.jinja2 +++ b/octoprint_klipper/templates/klipper_settings.jinja2 @@ -26,6 +26,12 @@ +
+ +
+ +
+