Simple-Logger/__init__.py
2024-01-03 11:27:05 -07:00

11 lines
307 B
Python

import os, datetime
if os.path.isfile("logs/main.log"):
if os.path.getsize("logs/main.log") >= 128000:
ct = datetime.datetime.now()
os.rename("logs/main.log", "logs/"+str(ct).replace(" ", "-")+".log")
else:
if not os.path.exists("logs"):
os.makedirs("logs")
f = open("logs/main.log", "w").close()