Logging
To debug your state machine, you can adjust the log level to see individual transitions. There are the following log levels:
- DEBUG: Most fine-grained logging, printing everything
- INFO: Only the most important informational log items
- WARN: Show only warnings and errors.
- ERROR: Show only error messages.
To change the log level for STMPY state machine:
import logging
= logging.DEBUG
debug_level = logging.getLogger('stmpy')
logger
logger.setLevel(debug_level)= logging.StreamHandler()
ch
ch.setLevel(debug_level)= logging.Formatter('%(asctime)s - %(name)-12s - %(levelname)-8s - %(message)s')
formatter
ch.setFormatter(formatter) logger.addHandler(ch)