gcode: Make dump_debug() output atomic

Build a single (very large) logging message with the debug state.
This prevents the output from being fragmented.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2017-09-27 11:54:53 -04:00
parent 8d04d3d8fd
commit 6e5bcc69bc
1 changed files with 4 additions and 2 deletions

View File

@ -78,10 +78,12 @@ class GCodeParser:
if self.fan is not None: if self.fan is not None:
self.fan.set_speed(print_time, 0.) self.fan.set_speed(print_time, 0.)
def dump_debug(self): def dump_debug(self):
logging.info("Dumping gcode input %d blocks" % ( out = []
out.append("Dumping gcode input %d blocks" % (
len(self.input_log),)) len(self.input_log),))
for eventtime, data in self.input_log: for eventtime, data in self.input_log:
logging.info("Read %f: %s" % (eventtime, repr(data))) out.append("Read %f: %s" % (eventtime, repr(data)))
logging.info("\n".join(out))
# Parse input into commands # Parse input into commands
args_r = re.compile('([A-Z_]+|[A-Z*])') args_r = re.compile('([A-Z_]+|[A-Z*])')
def process_commands(self, commands, need_ack=True): def process_commands(self, commands, need_ack=True):