Esempio n. 1
0
    def check_and_log_activation_change(self):
        now = int(time.time())

        was_active = self.is_active
        self.is_active = self.is_time_valid(now)

        # If we got a change, log it!
        if self.is_active != was_active:
            _from = 0
            _to = 0
            # If it's the start, get a special value for was
            if was_active is None:
                _from = -1
            if was_active:
                _from = 1
            if self.is_active:
                _to = 1

            # Now raise the log
            console_logger.info('TIMEPERIOD TRANSITION: %s;%d;%d' %
                                (self.get_name(), _from, _to))
Esempio n. 2
0
    def check_and_log_activation_change(self):
        now = int(time.time())

        was_active = self.is_active
        self.is_active = self.is_time_valid(now)

        # If we got a change, log it!
        if self.is_active != was_active:
            _from = 0
            _to = 0
            # If it's the start, get a special value for was
            if was_active is None:
                _from = -1
            if was_active:
                _from = 1
            if self.is_active:
                _to = 1

            # Now raise the log
            console_logger.info('TIMEPERIOD TRANSITION: %s;%d;%d'
                                % (self.get_name(), _from, _to))
Esempio n. 3
0
 def raise_cancel_downtime_log_entry(self):
     console_logger.info("CONTACT DOWNTIME ALERT: %s;CANCELLED; Scheduled "
                         "downtime for contact has been cancelled."
                         % self.get_name())
Esempio n. 4
0
 def raise_exit_downtime_log_entry(self):
     console_logger.info("CONTACT DOWNTIME ALERT: %s;STOPPED; Contact has "
                         "exited from a period of scheduled downtime"
                         % self.get_name())
Esempio n. 5
0
 def raise_enter_downtime_log_entry(self):
     console_logger.info("CONTACT DOWNTIME ALERT: %s;STARTED; Contact has "
                         "entered a period of scheduled downtime"
                         % self.get_name())
Esempio n. 6
0
 def raise_cancel_downtime_log_entry(self):
     console_logger.info(
         "CONTACT DOWNTIME ALERT: %s;CANCELLED; Scheduled "
         "downtime for contact has been cancelled." % self.get_name()
     )
Esempio n. 7
0
 def raise_exit_downtime_log_entry(self):
     console_logger.info(
         "CONTACT DOWNTIME ALERT: %s;STOPPED; Contact has "
         "exited from a period of scheduled downtime" % self.get_name()
     )
Esempio n. 8
0
 def raise_enter_downtime_log_entry(self):
     console_logger.info(
         "CONTACT DOWNTIME ALERT: %s;STARTED; Contact has "
         "entered a period of scheduled downtime" % self.get_name()
     )