def log_warning(message: str):
            from petisco import Petisco, DEBUG, LogMessage

            logger = Petisco.get_logger()
            log_message = LogMessage(operation="persistence",
                                     layer="infrastructure")
            logger.log(DEBUG, log_message.set_message(message))
        def _log_stop_exception(e: Exception):
            from petisco import LogMessage, ERROR, Petisco

            logger = Petisco.get_logger()
            log_message = LogMessage(layer="petisco",
                                     operation=f"RabbitMQEventSubscriber")
            message = f"Error stopping RabbitMQEventSubscriber: {repr(e.__class__)} {e} | {traceback.format_exc()}"
            logger.log(ERROR, log_message.set_message(message))
from meiga import Result
from petisco import controller_handler, Petisco

from taskmanager.src.modules.events.application.retrieve.events_retriever import (
    EventsRetriever, )


def success_handler(result: Result):
    events = [event.to_dict() for event in result.value]
    return {"events": events}, 200


@controller_handler(logger=Petisco.get_logger(),
                    success_handler=success_handler)
def get_events():
    use_case = EventsRetriever(
        repository=Petisco.get_repository("event"),
        publisher=Petisco.get_event_publisher(),
    )
    return use_case.execute()
def scheduled_task():
    Petisco.get_logger().log(INFO, LogMessage().set_message("scheduled_task"))
def recurring_task():
    Petisco.get_logger().log(INFO, LogMessage().set_message("recurring_task"))
def instant_task():
    Petisco.get_logger().log(INFO, LogMessage().set_message("instant_task"))