Ignore:
Timestamp:
04/21/12 14:49:45 (12 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
hg-Phase:
(<MercurialRepository 1 'hg:/home/ivaradi/mlx/hg' '/'>, 'public')
Message:

The PIREP can be created and sent.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/logger.py

    r96 r97  
    44
    55import const
     6import util
    67
    78import sys
     
    3233        self._lines = []
    3334        self._faults = {}
     35        self._faultLineIndexes = []
    3436        self._output = output
    3537
    36     @staticmethod
    37     def _getTimeStr(timestamp):
    38         """Get the string representation of the given timestamp."""
    39         return time.strftime("%H:%M:%S", time.gmtime(timestamp))
     38    @property
     39    def lines(self):
     40        """Get the lines of the log."""
     41        return self._lines
     42
     43    @property
     44    def faultLineIndexes(self):
     45        """Get the array of the indexes of the log line that contains a
     46        fault."""
     47        return self._faultLineIndexes
    4048
    4149    def reset(self):
     
    4553        self._lines = []
    4654        self._faults.clear()
     55        self._faultLineIndexes = []
    4756               
    4857    def message(self, timestamp, msg):
    4958        """Put a simple textual message into the log with the given timestamp."""
    50         timeStr = Logger._getTimeStr(timestamp)
     59        timeStr = util.getTimestampString(timestamp)
    5160        return self._logLine(msg, timeStr)
    5261
     
    7887        self._faults[faultID] = score
    7988        if score==Logger.NO_GO_SCORE:
    80             self.message(timestamp, "%s (NO GO)" % (what))
     89            lineIndex = self.message(timestamp, "%s (NO GO)" % (what))
    8190        else:
    82             self.message(timestamp, "%s (%.1f)" % (what, score))
     91            lineIndex = self.message(timestamp, "%s (%.1f)" % (what, score))
     92        self._faultLineIndexes.append(lineIndex)
    8393
    8494    def noGo(self, faultID, timestamp, what):
Note: See TracChangeset for help on using the changeset viewer.