Logging and reporting in Sikuli scripts
- Keywords:
- Last updated by:
- RaiMan
This from comment # 4 (Harry Riedinger https:/
of question https:/
-------
The python logging class is very easy to set up and I recommend using that for logging.
information on python logging is here: http://
here is a quick, basic example of using logging:
import logging
# when run in IDE with reruns to avoid errors use
import logging; reload(logging)
#create a new logging instance
logger = logging.
#set the file to log to
logger.
#set the logging level, DEBUG is the most verbose level
logger.
logger.info("We are starting now")
def functionInMyScr
logger.
# do something that might fail
logger.
try:
functionInM
logger.
except
logger.
_______
You can also set up filters and log to different files depending on the log level.
Because logger uses handlers, you can do all this with a single logging instance.
It is a very flexible logging solution.