🥅 Logging for start/pause/resume/cancel print

Always logs responsible user or plugin to comm INFO log.

Implements #3766
This commit is contained in:
Gina Häußge committed 2020-10-19 11:03:21 +02:00
1 parent 2acf4764c2
commit 83c411b308
1 file changed
+30 -3
+30 -3
View File
@@ -1368,6 +1368,15 @@ class MachineCom(object):
if tags is None:
tags = set()
if "source:plugin" in tags:
for tag in tags:
if tag.startswith("plugin:"):
self._logger.info(
"Starting job on behalf of plugin {}".format(tag[7:])
)
elif "source:api" in tags:
self._logger.info("Starting job on behalf of user {}".format(user))
try:
with self._jobLock:
self._consecutive_not_sd_printing = 0
@@ -1598,6 +1607,9 @@ class MachineCom(object):
tags=None,
external_sd=False,
):
if tags is None:
tags = set()
if not self.isOperational():
return
@@ -1605,14 +1617,20 @@ class MachineCom(object):
# we aren't even printing, nothing to cancel...
return
if "source:plugin" in tags:
for tag in tags:
if tag.startswith("plugin:"):
self._logger.info(
"Cancelling job on behalf of plugin {}".format(tag[7:])
)
elif "source:api" in tags:
self._logger.info("Cancelling job on behalf of user {}".format(user))
if self.isStreaming():
# we are streaming, we handle cancelling that differently...
self.cancelFileTransfer()
return
if tags is None:
tags = set()
def _on_M400_sent():
# we don't call on_print_job_cancelled on our callback here
# because we do this only after our M114 has been answered
@@ -1736,6 +1754,15 @@ class MachineCom(object):
if tags is None:
tags = set()
if "source:plugin" in tags:
for tag in tags:
if tag.startswith("plugin:"):
self._logger.info(
"Pausing/resuming job on behalf of plugin {}".format(tag[7:])
)
elif user:
self._logger.info("Pausing/resuming job on behalf of user {}".format(user))
valid_paused_states = (self.STATE_PAUSED, self.STATE_PAUSING)
valid_running_states = (
self.STATE_PRINTING,