Source code for kappa_sdk.user_tasks.simulation.log
from ..log import Log
[docs]
class LogSimulated(Log):
    """User Task logging simulation.
    Performs logging to the standard output.
    .. note:: Should not be instantiated directly.
    """
[docs]
    def info(self, message: str) -> None:
        """Logs an info message using a logger, associated with a running User Task.
        Parameters
        ----------
        message:
            The message to log.
        Raises
        ------
        TypeError
            If parameter has an unexpected type.
        """
        if not isinstance(message, str):
            raise TypeError('The "message" parameter of type "str" is expected, but an instance of a different type was given.')
        print("[INFO] {}".format(message)) 
[docs]
    def debug(self, message: str) -> None:
        """Logs a debug message using a logger, associated with a running User Task.
        Parameters
        ----------
        message:
            The message to log.
        Raises
        ------
        TypeError
            If parameter has an unexpected type.
        """
        if not isinstance(message, str):
            raise TypeError('The "message" parameter of type "str" is expected, but an instance of a different type was given.')
        print("[DEBUG] {}".format(message)) 
[docs]
    def warning(self, message: str) -> None:
        """Logs a warning message using a logger, associated with a running User Task.
        Parameters
        ----------
        message:
            The message to log.
        Raises
        ------
        TypeError
            If parameter has an unexpected type.
        """
        if not isinstance(message, str):
            raise TypeError('The "message" parameter of type "str" is expected, but an instance of a different type was given.')
        print("[WARNING] {}".format(message)) 
[docs]
    def error(self, message: str) -> None:
        """Logs an error message using a logger, associated with a running User Task.
        Parameters
        ----------
        message:
            The message to log.
        Raises
        ------
        TypeError
            If parameter has an unexpected type.
        """
        if not isinstance(message, str):
            raise TypeError('The "message" parameter of type "str" is expected, but an instance of a different type was given.')
        print("[ERROR] {}".format(message)) 
[docs]
    def fatal(self, message: str) -> None:
        """Logs a fatal message using a logger, associated with a running User Task.
        Parameters
        ----------
        message:
            The message to log.
        Raises
        ------
        TypeError
            If parameter has an unexpected type.
        """
        if not isinstance(message, str):
            raise TypeError('The "message" parameter of type "str" is expected, but an instance of a different type was given.')
        print("[FATAL] {}".format(message))