Simple-Logger/__init__.py

11 lines
307 B
Python
Raw Permalink Normal View History

2024-01-03 10:27:05 -08:00
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()