Utils

App Initiating and handling

utils.logger.critical(message, *args, **kwargs)

Logs a message with level FATAL. The arguments are interpreted as for debug().

utils.logger.debug(message, *args, **kwargs)

Logs a message with level DEBUG.

‘message’ is the message format string, and the args are the arguments which are merged into msg using the string formatting operator. (Note that this means that you can use keywords in the format string, together with a single dictionary argument.)

utils.logger.error(message, *args, **kwargs)

Logs a message with level ERROR. The arguments are interpreted as for debug().

utils.logger.fatal(message, *args, **kwargs)

Logs a message with level FATAL. The arguments are interpreted as for debug().

utils.logger.info(message, *args, **kwargs)

Logs a message with level INFO. The arguments are interpreted as for debug().

utils.logger.progress(message, *args, **kwargs)

Provides information about Tool progress.

Logs a message containing information about Tool progress, with level PROGRESS.

The arguments are interpreted as for debug() (see below for exceptions).

This function provides two pre-baked log message formats, that can be activated by specifying the following items in **kwargs:

Parameters:
  • status (str) – Status of the Tool logs “MESSAGE - STATUS”
  • task_id (int) – Current task; requires also the “total” item logs “MESSAGE (TASK_ID/TOTAL)
  • total (int) – Total number of tasks, should be provided in conjunction with task_id logs “MESSAGE (TASK_ID/TOTAL)

Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
class TestTool(Tool):
    def run(self, input_files, input_metadata, output_files):
        logger.progress("TestTool starting", status="RUNNING")
        total_tasks = 3

        self.task1()
        logger.progress("TestTool", task_id=1, total=total_tasks)

        self.task2()
        logger.progress("TestTool", task_id=2, total=total_tasks)

        self.task3()
        logger.progress("TestTool", task_id=3, total=total_tasks)

        logger.progress("TestTool", status="DONE")
        return True
utils.logger.warn(message, *args, **kwargs)

Logs a message with level WARNING. The arguments are interpreted as for debug().

utils.logger.warning(message, *args, **kwargs)

Logs a message with level WARNING. The arguments are interpreted as for debug().