1
0
Fork 0
This repository has been archived on 2024-02-17. You can view files and clone it, but cannot push or open issues or pull requests.
Administrator-py/administrator/logger.py

21 lines
544 B
Python
Raw Normal View History

2020-04-08 17:11:23 +02:00
import logging
from logging import handlers
from os import mkdir
from os.path import isdir
if not isdir("../logs"):
mkdir("../logs")
log_format = "{%(levelname)s}[%(asctime)s]: %(name)s | %(message)s"
logging.basicConfig(
format=log_format,
level=logging.INFO
)
logger = logging.getLogger("Administrator")
2020-04-08 17:11:23 +02:00
handler = handlers.TimedRotatingFileHandler("../logs/current.log", when="d", interval=1)
handler.suffix = "%Y-%m-%d"
handler.style = log_format
handler.setFormatter(logging.Formatter(log_format))
logger.addHandler(handler)