Import 2017-06-07 23:51:09: master a7421fc9

Author Committer Branch Timestamp Parent
jcfr jcfr master 2014-12-10 17:10:30 master 0940a0a7
Changeset

ENH: Use Python logging framework for scripted module logging

Use Python's built-in logging module to manage logging. A direct advantage is that line number, file name, method name can be logged, too. Also, it follows the convention of using qt-style logging in qt classes, vtk-style logging in vtk classes, etc.

Default behavior of log levels:
DEBUG: log to application log only, includes file name, line number, thread
INFO: log to stdout (appears in application log, too)
WARNING: log to stderr (appears in application log, too)
ERROR: log to stderr (appears in application log, too)

Usage:
import logging

[...]

logging.debug("this is a debug message")
logging.info("this is an info message")
logging.warning("this is a warning message")
logging.error("this is a error message")

From: Andras Lasso <lasso@queensu.ca>

git-svn-id: http://svn.slicer.org/Slicer4/trunk@23828 3bd1e089-480b-0410-8dfb-8563597acbee

mod - Base/Python/CMakeLists.txt Diff File
mod - Base/Python/slicer/ScriptedLoadableModule.py Diff File
mod - Base/Python/slicer/__init__.py.in Diff File
rm - Base/Python/slicer/log.py Diff File
mod - Base/Python/slicer/util.py Diff File
mod - Extensions/Testing/ScriptedLoadableExtensionTemplate/ScriptedLoadableModuleTemplate/ScriptedLoadableModuleTemplate.py Diff File
mod - Utilities/Scripts/SlicerWizard/Utilities.py Diff File
mod - Utilities/Templates/Modules/Scripted/TemplateKey.py Diff File