Messages management

Module for centralized management of messages to the user and logging.

src.lib.messages.get_status(logger_name, message_id, param=None)

Gets the content (flag, level and message) for a given ID and adds an entry to the logger, according to the level of the content. The logger must be passed to the method.

Note

There are 3 elements as general abstraction, described below:

  • flag: status of success, neutral or fail. Neutral is intended only for cases where a clear definition of success or fail is not possible.

  • level: level for the logging: DEBUG, INFO, WARNING, ERROR. By default (proposal from example.py) the console will display up to INFO level, while the log file will store up to DEBUG level.

  • message: text to be displayed or logged for supporting user.

Parameters
  • logger_name (string) – Logger name for handling the content. This follows the logging library for Python.

  • message_id (string) – Identifies which message from the dictionary to be returned, along with the flag and level information.

  • param (tuple of strings, optional) – For messages which have parameters to be set (using %s), this parameter will be used in the order passed. In case this parameter is passed as a single string, it will be automatically converted into a tuple (of 1 entry).