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. """ 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)) 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)) 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)) 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)) 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))