imfusion.log#
Submodule for ImFusion SDK logging.
Write messages with imfusion.log.trace(), imfusion.log.debug(), imfusion.log.info(),
imfusion.log.warn(), and imfusion.log.error().
Configure the log level with imfusion.log.set_level() and imfusion.log.level(),
or hand control over to Python’s logging module with imfusion.log.transfer_to_python().
- imfusion.log.level() int#
Returns the level of the logging in the ImFusionSDK (Trace = 0, Debug = 1, Info = 2, Warning = 3, Error = 4, Fatal = 5, Quiet = 6)
- imfusion.log.set_level(level: SupportsInt | SupportsIndex) None#
Sets the level of the logging in the ImFusionSDK (Trace = 0, Debug = 1, Info = 2, Warning = 3, Error = 4, Fatal = 5, Quiet = 6).
The initial log level is 3 (Warning), but can be set explicitly with the IMFUSION_LOG_LEVEL environment variable.
Note
After calling
imfusion.log.transfer_to_python()this function has no effect.
- imfusion.log.transfer_to_python() None#
Transfers the control of logging from ImFusionLib to the “ImFusion” logger, which can obtained through the python’s logging module with
logging.getLogger("ImFusion").After calling
transfer_to_python, the configuration of the logger will be possible exclusively through the Python’s logging module interface, e.g. usinglogging.getLogger("ImFusion").setLevel. Besides, all the imfusion logs that happen after calling this function but before importing theloggingmodule will not be captured.Note
Please note that this redirection cannot be cancelled and that any subsequent calls to this functions will have no effect.
Warning
Due to the GIL, log messages from internal threads won’t be forwarded to the logger.