|
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
f.close()
def writeLog(self,message,module,type = None):
if(type == None):
type = self.TYPE_INFO
time = str(datetime.datetime.now())
if(type == self.TYPE_ERROR):
f = open(self.file,"a+")
f.write(time + " [" + module + "] " + "ERROR: " + message + "\n")
f.close()
elif(type == self.TYPE_WARNING):
f = open(self.file,"a+")
f.write(time + " [" + module + "] " + "WARNING: " + message + "\n")
f.close()
elif(type == self.TYPE_INFO):
f = open(self.file,"a+")
f.write(time + " [" + module + "] " + "INFO: " + message + "\n")
f.close()
else:
f = open(self.file,"a+")
f.write(message + "\n")
f.close()
|