queuelogger: Add critical information to each logfile on rollover

When the log file does a rollover, start the top of the log with
critical system information (eg, software versions).

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2017-05-01 13:44:06 -04:00
parent b5062a07d1
commit 31ca2331d2
3 changed files with 60 additions and 28 deletions

View file

@ -385,6 +385,8 @@ class MCU:
self._restart_method = config.getchoice(
'restart_method', rmethods, 'arduino')
# Config building
if printer.bglogger is not None:
printer.bglogger.set_rollover_info("mcu", None)
self._config_error = config.error
self._emergency_stop_cmd = self._reset_cmd = None
self._oids = []
@ -575,6 +577,15 @@ class MCU:
raise error("Printer CRC does not match config")
move_count = config_params['move_count']
logging.info("Configured (%d moves)" % (move_count,))
if self._printer.bglogger is not None:
msgparser = self.serial.msgparser
info = [
"Configured (%d moves)" % (move_count,),
"Loaded %d commands (%s)" % (
len(msgparser.messages_by_id), msgparser.version),
"MCU config: %s" % (" ".join(
["%s=%s" % (k, v) for k, v in msgparser.config.items()]))]
self._printer.bglogger.set_rollover_info("mcu", "\n".join(info))
stepqueues = tuple(s._stepqueue for s in self._steppers)
self._steppersync = self._ffi_lib.steppersync_alloc(
self.serial.serialqueue, stepqueues, len(stepqueues), move_count)