Files
2024-04-26 17:16:21 +05:30

21 lines
570 B
Python

import logging
import os
from logging.handlers import RotatingFileHandler
# removing old logs file if they exist.
try: os.remove("logs.txt")
except: pass
logging.basicConfig(
level=logging.INFO,
format="[%(asctime)s - %(levelname)s] - %(name)s - %(message)s",
datefmt="%d-%b-%y %H:%M:%S",
handlers=[
RotatingFileHandler("logs.txt", mode="w+", maxBytes=5000000, backupCount=10),
logging.StreamHandler()])
logging.getLogger("pyrogram").setLevel(logging.ERROR)
def LOGGER(name: str) -> logging.Logger:
return logging.getLogger(name)