Skip to content

ENH: Added logging functions for Python

Added info and error logging macros for Python modules. Usage examples

import slicer.log

slicer.log.info("This is an info message, logged as an INFO type message")
slicer.log.info("This is an info message, logged and also displayed in a popup for a short time", True)
slicer.log.info("This is an info message, logged and also displayed in a popup for 5 seconds", True, 5000)
slicer.log.info("This is an info message, logged and also displayed in a popup, the user has to click OK to continue", True, 0)

slicer.log.error("This is an error message, logged as an ERROR type message")
slicer.log.error("This is an error message, logged and also displayed in a popup, the user has to click OK to continue", True, 0)

Also updated the scripted loadable module template to perform actual image processing (thresholding, using a CLI) and not just capture a screenshot, because this is much closer to what most users would do.

Right now Python errors are logged as INFO messages due to a CTK bug. A pull request is submitted with a fix: https://github.com/commontk/CTK/pull/523

Merge request reports