Beispiel #1
0
    def __init__(self,
                 log_level=LOG_LEVEL.WARNING,
                 timestamp_format="%X"):
        Printer.__init__(self)
        LogPrinter.__init__(self, self, log_level, timestamp_format)

        self.logs = []
Beispiel #2
0
    def __init__(self,
                 section: Section,
                 message_queue,
                 timeout=0):
        """
        Constructs a new bear.

        :param section:       The section object where bear settings are
                              contained.
        :param message_queue: The queue object for messages. Can be ``None``.
        :param timeout:       The time the bear is allowed to run. To set no
                              time limit, use 0.
        :raises TypeError:    Raised when ``message_queue`` is no queue.
        :raises RuntimeError: Raised when bear requirements are not fulfilled.
        """
        Printer.__init__(self)
        LogPrinter.__init__(self, self)

        if message_queue is not None and not hasattr(message_queue, "put"):
            raise TypeError("message_queue has to be a Queue or None.")

        self.section = section
        self.message_queue = message_queue
        self.timeout = timeout

        self.setup_dependencies()
        cp = type(self).check_prerequisites()
        if cp is not True:
            error_string = ("The bear " + self.name +
                            " does not fulfill all requirements.")
            if cp is not False:
                error_string += " " + cp

            self.warn(error_string)
            raise RuntimeError(error_string)
Beispiel #3
0
    def __init__(self,
                 section: Section,
                 message_queue,
                 timeout=0):
        """
        Constructs a new bear.

        :param section:       The section object where bear settings are
                              contained.
        :param message_queue: The queue object for messages. Can be ``None``.
        :param timeout:       The time the bear is allowed to run. To set no
                              time limit, use 0.
        :raises TypeError:    Raised when ``message_queue`` is no queue.
        :raises RuntimeError: Raised when bear requirements are not fulfilled.
        """
        Printer.__init__(self)
        LogPrinter.__init__(self, self)

        if message_queue is not None and not hasattr(message_queue, "put"):
            raise TypeError("message_queue has to be a Queue or None.")

        self.section = section
        self.message_queue = message_queue
        self.timeout = timeout

        self.setup_dependencies()
        cp = type(self).check_prerequisites()
        if cp is not True:
            error_string = ("The bear " + self.name +
                            " does not fulfill all requirements.")
            if cp is not False:
                error_string += " " + cp

            self.warn(error_string)
            raise RuntimeError(error_string)
Beispiel #4
0
    def __init__(self,
                 section: Section,
                 message_queue,
                 timeout=0):
        Printer.__init__(self)
        LogPrinter.__init__(self, self)

        if not hasattr(message_queue, "put") and message_queue is not None:
            raise TypeError("message_queue has to be a Queue or None.")

        self.section = section
        self.message_queue = message_queue
        self.timeout = timeout
Beispiel #5
0
    def __init__(self,
                 filename,
                 log_level=LOG_LEVEL.WARNING,
                 timestamp_format="%X"):
        """
        Creates a new FilePrinter. If the directory of the given file doesn't exist or if there's any access problems,
        an exception will be thrown.

        :param filename: the name of the file to put the data into (string).
        """
        self.file = None
        if not isinstance(filename, str):
            raise TypeError("filename must be a string.")

        LogPrinter.__init__(self,
                            timestamp_format=timestamp_format,
                            log_level=log_level)

        self.file = open(filename, 'a+')
Beispiel #6
0
 def __init__(self, log_level=LOG_LEVEL.WARNING, timestamp_format="%X"):
     ColorPrinter.__init__(self)
     LogPrinter.__init__(self, log_level=log_level, timestamp_format=timestamp_format)
 def __init__(self, log_queue):
     LogPrinter.__init__(self, self)
     self.log_queue = log_queue
     self.set_up = False
Beispiel #8
0
 def __init__(self, log_queue):
     LogPrinter.__init__(self, self)
     self.log_queue = log_queue
     self.set_up = False
Beispiel #9
0
 def __init__(self):
     ColorPrinter.__init__(self)
     LogPrinter.__init__(self)
 def __init__(self):
     LogPrinter.__init__(self, self)
Beispiel #11
0
 def __init__(self):
     LogPrinter.__init__(self, self)
Beispiel #12
0
 def __init__(self, result_queue, log_queue):
     Interactor.__init__(self)
     LogPrinter.__init__(self)
     self.result_queue = result_queue
     self.log_queue = log_queue
     self.set_up = False
Beispiel #13
0
    def __init__(self, log_level=LOG_LEVEL.WARNING, timestamp_format="%X"):
        Printer.__init__(self)
        LogPrinter.__init__(self, self, log_level, timestamp_format)

        self.logs = []
Beispiel #14
0
 def __init__(self, log_level=LOG_LEVEL.WARNING, timestamp_format="%X"):
     ColorPrinter.__init__(self)
     LogPrinter.__init__(self, log_level=log_level, timestamp_format=timestamp_format)