Changeset 769 for branches


Ignore:
Timestamp:
Nov 14, 2007 4:55:32 AM (12 years ago)
Author:
stefan
Message:

make the logfile object a global variable

Location:
branches/testScripts
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/testScripts/NBlogMessages.py

    r746 r769  
    1111execfile('NBuserParameters.py')
    1212
    13 #TODO: one could open the logfile once in the beginning, set it to sys.stdout, flush after each message, and close it finally
    14 
    1513LOG_MESSAGES=''
    1614FULL_LOG_MESSAGES=''
     15logfile=''
    1716
    1817def clearMessages():
     
    3332  return retVal
    3433
     34def openLogFile():
     35  global logfile
     36  logfile=open(NIGHTLY_BUILD_ROOT_DIR+'/'+LOGFILE, 'a')
     37   
     38def closeLogFile():
     39  global logfile
     40  logfile.close()
    3541
    3642#------------------------------------------------------------------------
     
    4551    print logMsg
    4652  if len(LOGFILE) > 0 and not LOGFILE.isspace() :
    47     logfile=open(NIGHTLY_BUILD_ROOT_DIR+'/'+LOGFILE, 'a')
     53    global logfile
    4854    logfile.write(logMsg+'\n')
    49 #    logfile.flush()
    50     logfile.close()
     55    logfile.flush()
  • branches/testScripts/nightlyBuild.py

    r750 r769  
    4141  os.makedirs(NIGHTLY_BUILD_ROOT_DIR)
    4242os.chdir( NIGHTLY_BUILD_ROOT_DIR)
     43
     44#------------------------------------------------------------------------
     45#  If needed open the logfile
     46#------------------------------------------------------------------------
     47
     48if len(LOGFILE) > 0 and not LOGFILE.isspace() :
     49  NBlogMessages.openLogFile()
    4350
    4451#------------------------------------------------------------------------
     
    254261NBemail.send(toAddrs,subject,NBlogMessages.getAllMessages())
    255262
     263#------------------------------------------------------------------------
     264#  If needed close the logfile
     265#------------------------------------------------------------------------
     266
     267if len(LOGFILE) > 0 and not LOGFILE.isspace() :
     268  NBlogMessages.closeLogFile()
     269
    256270sys.exit(0)
    257271
Note: See TracChangeset for help on using the changeset viewer.