Python

System loggings

from IRAPy import logger
     logger.logNotice("My system log message")

Custom loggings

from IRAPy import userLogger
logger.logNotice("My user log message")

System exceptions

from IRAPy import logger
ex=MyErrroExImpl()
logger.logException(ex)

Custom exceptions

from IRAPy import userLogger
ex=MyErrroExImpl()
userLogger.logException(ex)

Interaction with operator input

This function is for components development. The user message is encapsulated with the exception and presented to the user if the error is directly generated by a user command.

from IRAPy import logger
from SimpleParserPy import add_user_message
ex=MyErrroExImpl()
add_user_message(ex,"My special message to the user",False)
raise ex

This macro is for stand alone programs that are issued as system calls by the command parser. The user message is handled like the other case and it’s also written into standard err and intercepted by the parser to be shown to the user.

from IRAPy import logger
from SimpleParserPy import add_user_message
newEx = ClientErrorsImpl.CouldntPerformActionExImpl()
add_user_message(newEx,"My special message to the user")
userLogger.logException(newEx)
sys.exit(1)