source: branches/testScripts/NBlogMessages.py @ 681

Last change on this file since 681 was 681, checked in by jpfasano, 12 years ago

Added svn property svn:eol-style native

  • Property svn:eol-style set to native
File size: 725 bytes
Line 
1#! /usr/bin/env python
2
3import time
4import NBuserConfig
5
6#TODO: one could open the logfile once in the beginning, set it to sys.stdout, flush after each message, and close it finally
7
8#------------------------------------------------------------------------
9# Function to write log messages
10#------------------------------------------------------------------------
11def writeMessage( msg ) :
12  logMsg = time.ctime(time.time())+': '
13  logMsg += msg
14  if NBuserConfig.LOGPRINT :
15    print logMsg
16  if len(NBuserConfig.LOGFILE) > 0 and not NBuserConfig.LOGFILE.isspace() :
17    logfile=open(NBuserConfig.NIGHTLY_BUILD_ROOT_DIR+'/'+NBuserConfig.LOGFILE, 'a')
18    logfile.write(logMsg+'\n')
19#    logfile.flush()
20    logfile.close()
Note: See TracBrowser for help on using the repository browser.