31 lines
554 B
Python
31 lines
554 B
Python
|
import time
|
||
|
import threading
|
||
|
|
||
|
gLogFilePath = '/var/log/ClusterController.log'
|
||
|
|
||
|
def log( message ):
|
||
|
return
|
||
|
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)
|
||
|
|