Ignore:
Timestamp:
05/28/12 05:07:31 (12 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

Added timestamping to the debug log

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/gui/gui.py

    r202 r203  
    2626import threading
    2727import sys
     28import datetime
    2829
    2930#------------------------------------------------------------------------------
     
    6364        self._stdioLock = threading.Lock()
    6465        self._stdioText = ""
     66        self._stdioStartingLine = True
    6567
    6668        self._sendPIREPCallback = None
     
    715717            text = lines[-1]
    716718            lines = lines[:-1]
     719
     720        now = datetime.datetime.now()
     721        timeStr = "%02d:%02d:%02d: " % (now.hour, now.minute, now.second)
    717722           
    718723        for line in lines:
    719724            #print >> sys.__stdout__, line
     725            if self._stdioStartingLine:
     726                self._writeLog(timeStr, self._debugLogView)
    720727            self._writeLog(line + "\n", self._debugLogView)
     728            self._stdioStartingLine = True
    721729
    722730        if text:
    723731            #print >> sys.__stdout__, text,
     732            if self._stdioStartingLine:
     733                self._writeLog(timeStr, self._debugLogView)
    724734            self._writeLog(text, self._debugLogView)
     735            self._stdioStartingLine = False
    725736
    726737    def connectSimulator(self, aircraftType):
Note: See TracChangeset for help on using the changeset viewer.