aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2016-12-24 10:17:12 -0500
committerKevin O'Connor <kevin@koconnor.net>2016-12-24 10:18:41 -0500
commitd0c61f0f76b116e07567e6fbfe2a6bb585545249 (patch)
treec373d16577757e004350983a84da0d840250a6eb
parent451ffd567d3a2b4871229681ec0449b87cc519f5 (diff)
downloadkutter-d0c61f0f76b116e07567e6fbfe2a6bb585545249.tar.gz
kutter-d0c61f0f76b116e07567e6fbfe2a6bb585545249.tar.xz
kutter-d0c61f0f76b116e07567e6fbfe2a6bb585545249.zip
klippy: Log the contents of the config file at startup
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r--docs/Todo.md3
-rw-r--r--klippy/klippy.py10
2 files changed, 10 insertions, 3 deletions
diff --git a/docs/Todo.md b/docs/Todo.md
index b3dec34c..71c68c3f 100644
--- a/docs/Todo.md
+++ b/docs/Todo.md
@@ -31,9 +31,6 @@ Host user interaction
* Automatically roll Klippy log files. The default log file should
have the current date in the log file name.
- * Report the Klippy git version in log file. Log the contents of the
- config file at startup.
-
* Possibly collate and report the statistics messages in the log in a
more friendly way.
diff --git a/klippy/klippy.py b/klippy/klippy.py
index 7c1b7618..f9f55de1 100644
--- a/klippy/klippy.py
+++ b/klippy/klippy.py
@@ -73,6 +73,14 @@ class ConfigWrapper:
def getsection(self, section):
return ConfigWrapper(self.printer, section)
+class ConfigLogger():
+ def __init__(self, cfg):
+ logging.info("===== Config file =====")
+ cfg.write(self)
+ logging.info("=======================")
+ def write(self, data):
+ logging.info(data.strip())
+
class Printer:
def __init__(self, conffile, input_fd, is_fileinput=False):
self.conffile = conffile
@@ -112,6 +120,8 @@ class Printer:
if not res:
raise ConfigParser.Error("Unable to open config file %s" % (
self.conffile,))
+ if self.debugoutput is None:
+ ConfigLogger(self.fileconfig)
self.mcu = mcu.MCU(self, ConfigWrapper(self, 'mcu'))
if self.fileconfig.has_section('fan'):
self.objects['fan'] = fan.PrinterFan(