Ignore:
Timestamp:
02/15/12 20:03:48 (13 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

The logger is now reset when connecting.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/logger.py

    r21 r24  
    3737        """Get the string representation of the given timestamp."""
    3838        return time.strftime("%H:%M:%S", time.gmtime(timestamp))
     39
     40    def reset(self):
     41        """Reset the logger.
     42
     43        The faults logged so far will be cleared."""
     44        self._faults.clear()
    3945               
    4046    def message(self, timestamp, msg):
     
    5864        s = Logger._stages[stage] if stage in Logger._stages else "<Unknown>"
    5965        self.message(timestamp, "--- %s ---" % (s,))
     66        if stage==const.STAGE_END:
     67            totalScore = 100
     68            for (id, score) in self._faults.iteritems():
     69                totalScore -= score
     70            self.untimedMessage("Score: %.0f" % (totalScore,))
    6071       
    6172    def fault(self, faultID, timestamp, what, score):
Note: See TracChangeset for help on using the changeset viewer.