log to file

This commit is contained in:
2024-03-20 14:18:38 +01:00
parent 53ea721cb6
commit 40c7c7cf96
4 changed files with 63 additions and 75 deletions
+13
View File
@@ -0,0 +1,13 @@
import datetime
import logging
from pathlib import Path
LOGS_DIR = str(Path.home())
def init_logger():
logging.basicConfig(filename=LOGS_DIR + "/request_{}.log".format(str(datetime.date.today())),
filemode='a',
format='%(asctime)s,%(msecs)d %(name)s %(levelname)s %(message)s',
datefmt='%Y-%m-%d %H:%M:%S',
level=logging.INFO)