Changes in / [b2b3009d:f68d503] in sasview


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • run.py

    r18e7309 r05a9d29  
    2020from os.path import abspath, dirname, join as joinpath 
    2121 
     22class TeeStream: 
     23    def __init__(self, filename): 
     24        self.logfile = open(filename, 'a') 
     25        self.console = sys.stderr 
     26    def write(self, buf): 
     27        self.logfile.write(buf) 
     28        self.console.write(buf) 
     29 
     30def tee_logging(): 
     31    import logging 
     32    stream = TeeStream(os.path.join(os.path.expanduser("~"), 'sasview.log')) 
     33    logging.basicConfig(level=logging.INFO, 
     34                        format='%(asctime)s %(levelname)s %(message)s', 
     35                        stream=stream) 
    2236 
    2337def addpath(path): 
     
    139153if __name__ == "__main__": 
    140154    prepare() 
     155    tee_logging() 
    141156    from sas.sasview.sasview import run 
    142157    run() 
Note: See TracChangeset for help on using the changeset viewer.