source: branches/testScripts/NBlogMessages.py @ 741

Last change on this file since 741 was 741, checked in by jpfasano, 13 years ago

more clean up. email should now include nightlyBuild log messages

  • Property svn:eol-style set to native
File size: 1.2 KB
Line 
1#! /usr/bin/env python
2
3#------------------------------------------------------------------------
4# This file is distributed under the Common Public License.
5# It is part of the BuildTools project in COIN-OR (www.coin-or.org)
6#------------------------------------------------------------------------
7
8import time
9
10execfile('NBuserParametersDefault.py')
11execfile('NBuserParameters.py')
12
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
15LOG_MESSAGES=''
16
17def clearMessages():
18  global LOG_MESSAGES
19  LOG_MESSAGES=''
20
21def getMessages():
22  global LOG_MESSAGES
23  return LOG_MESSAGES
24
25
26#------------------------------------------------------------------------
27# Function to write log messages
28#------------------------------------------------------------------------
29def writeMessage( msg ) :
30  global LOG_MESSAGES
31  logMsg = time.ctime(time.time())+': '
32  logMsg += msg
33  LOG_MESSAGES+=logMsg+'\n'
34  if LOGPRINT :
35    print logMsg
36  if len(LOGFILE) > 0 and not LOGFILE.isspace() :
37    logfile=open(NIGHTLY_BUILD_ROOT_DIR+'/'+LOGFILE, 'a')
38    logfile.write(logMsg+'\n')
39#    logfile.flush()
40    logfile.close()
Note: See TracBrowser for help on using the repository browser.