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

20 lines
544 B
Python

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")
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)