If serial.log is disabled, log how to enable it

That will hopefully help a bit against the endless stream of "serial
.log was empty" statements on the bug tracker. Or not. Here's hope.
This commit is contained in:
Gina Häußge 2017-10-26 13:13:21 +02:00
parent a1548e1c1d
commit 490ef61e19
2 changed files with 4 additions and 1 deletions

View file

@ -216,7 +216,7 @@ def init_logging(settings, use_logging_file=True, logging_file=None, default_con
},
"loggers": {
"SERIAL": {
"level": "CRITICAL",
"level": "INFO",
"handlers": ["serialFile"],
"propagate": False
},

View file

@ -208,6 +208,9 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
from octoprint.logging.handlers import SerialLogHandler
SerialLogHandler.on_open_connection()
if not logging.getLogger("SERIAL").isEnabledFor(logging.DEBUG):
# if serial.log is not enabled, log a line to explain that to reduce "serial.log is empty" in tickets...
logging.getLogger("SERIAL").info("serial.log is currently not enabled, you can enable it via Settings > Serial Connection > Log communication to serial.log")
self._comm = comm.MachineCom(port, baudrate, callbackObject=self, printerProfileManager=self._printerProfileManager)