Changeset 324:b1d504a874dc for src


Ignore:
Timestamp:
10/21/12 05:08:13 (12 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

Forced logging now logs with the current timestamp even for delayed change loggers (#133)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/checks.py

    r321 r324  
    275275        self._logInitial = logInitial   
    276276
    277     def _getLogTimestamp(self, state):
     277    def _getLogTimestamp(self, state, forced):
    278278        """Get the log timestamp."""
    279279        return state.timestamp
     
    294294        message = self._getMessage(flight, state, forced)
    295295        if message is not None:
    296             logger.message(self._getLogTimestamp(state), message)
     296            logger.message(self._getLogTimestamp(state, forced), message)
    297297       
    298298#-------------------------------------------------------------------------------
     
    351351
    352352        if self._firstChange is not None:
    353             if state.timestamp >= min(self._lastChangeState.timestamp + self._minDelay,
     353            if state.timestamp >= min(self._lastChangeState.timestamp +
     354                                      self._minDelay,
    354355                                      self._firstChange + self._maxDelay):
    355356                self._firstChange = None
     
    358359        return False
    359360
    360     def _getLogTimestamp(self, state):
     361    def _getLogTimestamp(self, state, forced):
    361362        """Get the log timestamp."""
    362         return self._lastChangeState.timestamp if \
    363                self._lastChangeState is not None else state.timestamp
     363        return self._lastChangeState.timestamp \
     364               if not forced and self._lastChangeState is not None \
     365               else state.timestamp
    364366
    365367    def _isDifferent(self, oldValue, newValue):
     
    398400        DelayedChangeMixin.__init__(self, minDelay = minDelay, maxDelay = maxDelay)
    399401        TemplateMessageMixin.__init__(self, template)
    400         self._getLogTimestamp = lambda state: \
    401                                 DelayedChangeMixin._getLogTimestamp(self, state)
     402        self._getLogTimestamp = \
     403           lambda state, forced: \
     404           DelayedChangeMixin._getLogTimestamp(self, state, forced)
    402405
    403406#---------------------------------------------------------------------------------------
     
    449452        SingleValueMixin.__init__(self, "altimeter")
    450453        DelayedChangeMixin.__init__(self)
    451         self._getLogTimestamp = lambda state: \
    452                                 DelayedChangeMixin._getLogTimestamp(self, state)
     454        self._getLogTimestamp = \
     455            lambda state, forced: \
     456            DelayedChangeMixin._getLogTimestamp(self, state, forced)
    453457
    454458    def _getMessage(self, flight, state, forced):
     
    482486                                          forced = forced)
    483487        self._getLogTimestamp = \
    484             lambda state: DelayedChangeMixin._getLogTimestamp(self, state)
     488            lambda state, forced: \
     489            DelayedChangeMixin._getLogTimestamp(self, state, forced)
    485490        self._changed = lambda oldState, state: \
    486491            ForceableLoggerMixin._changed(self, oldState, state)
Note: See TracChangeset for help on using the changeset viewer.