1
0
Fork 0
mirror of https://github.com/ThomasGsp/HyperProxmox.git synced 2025-03-09 15:40:18 +00:00

- Test log dir.

This commit is contained in:
Tlams 2018-04-12 17:07:50 +01:00
parent d280ab6bfc
commit 640334893d

View file

@ -113,17 +113,21 @@ class Logger2:
text = "[{date}] {info} : {text} \n".format(date=date, info=info, text=text)
if json_text["type"] == "PROXMOX":
errorlog = open("{0}/proxmox.log".format(self.logs_dir), "ab")
errorlog.write(text.encode('utf-8'))
elif json_text["type"] == "HYPERPROXMOX":
errorlog = open("{0}/hyperproxmox.log".format(self.logs_dir), "ab")
errorlog.write(text.encode('utf-8'))
elif json_text["type"] == "PYTHON":
errorlog = open("{0}/python.log".format(self.logs_dir), "ab")
errorlog.write(text.encode('utf-8'))
else:
errorlog = open("{0}/others.log".format(self.logs_dir), "ab")
errorlog.write(text.encode('utf-8'))
try:
if json_text["type"] == "PROXMOX":
errorlog = open("{0}/proxmox.log".format(self.logs_dir), "ab")
errorlog.write(text.encode('utf-8'))
elif json_text["type"] == "HYPERPROXMOX":
errorlog = open("{0}/hyperproxmox.log".format(self.logs_dir), "ab")
errorlog.write(text.encode('utf-8'))
elif json_text["type"] == "PYTHON":
errorlog = open("{0}/python.log".format(self.logs_dir), "ab")
errorlog.write(text.encode('utf-8'))
else:
errorlog = open("{0}/others.log".format(self.logs_dir), "ab")
errorlog.write(text.encode('utf-8'))
errorlog.close()
except BaseException:
print("Cannot write on {0}, please check permissions.".format(self.logs_dir))
exit(1)
errorlog.close()