示例#1
0
    def write(self, message: Any, level: DebugLevel = DebugLevel.BASIC, end: str = "\n", timestamp: bool = True,
              streams: List[StringIO] = None) -> None:
        if not streams:
            streams = []

        """
        Method used for writing to the console
        :param message: The message
        :param level: The debug level of information
        :param end: Terminator string
        :param timestamp: If a timestamp should be added
        """
        if self.should_debug(level):
            message = str(message)
            if timestamp:
                message = "[{}] - {}".format(Timer.get_current_timestamp(), message)
            print(message, end=end)

            for stream in streams:
                stream.write(message + end)
示例#2
0
 def write_error(message: Any) -> None:
     """
     Method for displaying errors
     :param message: The error message
     """
     print("ERROR [{}] - {}".format(Timer.get_current_timestamp(), str(message)), file=sys.stderr)