Athento allows you to view the logs generated after the last execution of an operation.
To view them, go to the Automation tab within a space and click on the icon available in each of the installed operations:
By clicking on this icon, if the operation has already been executed and is correctly configured to show logs, they will be displayed on screen:
Configure an operation to record and display its logs
For the logs to be shown on the previous screen, it is necessary to configure them in the operation code. To do so, use the OperationCustomLogger class, as shown in the following example.
Keep in mind that the code shown generates the logs from the previous example.
Code example:
from log_history.utils import OperationCustomLogger
__logger = OperationCustomLogger()
def run(uuid=None, **params):
__logger.initialize_logger(params.get('operation_uuid'))
__logger.info('Executing operation')
Steps to view and configure operation logs in Athento:
- Initialize the logger in the operation file using the provided class.
- Initialize the logger at the beginning of the “run” method. This allows the logger to know the operation UUID and thus distinguish from which space it was launched.
- Use the logger like any other logger.