2011-10-07 17:43:45 +02:00
|
|
|
import time
|
|
|
|
import threading
|
|
|
|
|
2012-03-07 09:59:19 +01:00
|
|
|
gLogFilePath = '/tmp/ClusterController.log'#'/var/log/ClusterController.log'
|
2011-10-07 17:43:45 +02:00
|
|
|
|
|
|
|
def log( message ):
|
|
|
|
threadName = threading.currentThread().getName()
|
|
|
|
logMessage = time.asctime(time.localtime())+' : '+ threadName + ' : ' + message
|
|
|
|
print logMessage
|
|
|
|
f = open(gLogFilePath, 'a+')
|
|
|
|
assert( f )
|
|
|
|
try:
|
|
|
|
f.write( logMessage + '\n' )
|
|
|
|
finally:
|
|
|
|
f.close()
|
|
|
|
|
|
|
|
def logDebug( message ):
|
|
|
|
log('[D]'+message)
|
|
|
|
return
|
|
|
|
|
|
|
|
def logInfo( message ):
|
|
|
|
log('[I]'+message)
|
|
|
|
|
|
|
|
def logWarning( message ):
|
|
|
|
log('[W]'+message)
|
|
|
|
|
|
|
|
def logError( message ):
|
|
|
|
log('[E]'+message)
|
|
|
|
|