add log path entry to config

This commit is contained in:
Schnello 2019-03-13 12:52:14 +01:00 committed by Alice Grey
parent a3a4202b00
commit 0141b5e130
2 changed files with 8 additions and 1 deletions

View File

@ -73,6 +73,7 @@ class KlipperPlugin(
), ),
configuration = dict( configuration = dict(
path="~/printer.cfg", path="~/printer.cfg",
logpath="/tmp/klippy.log",
reload_command="RESTART" reload_command="RESTART"
) )
) )
@ -290,7 +291,7 @@ class KlipperPlugin(
def on_api_command(self, command, data): def on_api_command(self, command, data):
if command == "listLogFiles": if command == "listLogFiles":
files = [] files = []
for f in glob.glob("/tmp/*.log*"): for f in glob.glob(self._settings.get(["configuration", "logpath"]) + "*"):
filesize = os.path.getsize(f) filesize = os.path.getsize(f)
files.append(dict( files.append(dict(
name=os.path.basename(f) + " ({:.1f} KB)".format(filesize / 1000.0), name=os.path.basename(f) + " ({:.1f} KB)".format(filesize / 1000.0),

View File

@ -26,6 +26,12 @@
<input type="text" class="input-block-level" data-bind="value: settings.settings.plugins.klipper.configuration.path"> <input type="text" class="input-block-level" data-bind="value: settings.settings.plugins.klipper.configuration.path">
</div> </div>
</div> </div>
<div class="control-group">
<label class="control-label">{{ _('Klipper Log Path') }}</label>
<div class="controls">
<input type="text" class="input-block-level" data-bind="value: settings.settings.plugins.klipper.configuration.logpath">
</div>
</div>
<div class="control-group"> <div class="control-group">
<label class="control-label">{{ _('Configuration Reload Command') }}</label> <label class="control-label">{{ _('Configuration Reload Command') }}</label>
<div class="controls"> <div class="controls">