File size: 736 Bytes
a8e9b84
359b1eb
 
 
 
 
 
a8e9b84
 
 
 
 
 
359b1eb
 
 
 
 
a8e9b84
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import logging
import os
from logging.handlers import RotatingFileHandler

# Ensure the /tmp directory exists
if not os.path.exists("/tmp"):
    os.makedirs("/tmp")

logging.basicConfig(
    level=logging.INFO,
    format="[%(asctime)s - %(levelname)s] - %(name)s - %(message)s",
    datefmt="%d-%b-%y %H:%M:%S",
    handlers=[
        RotatingFileHandler(
            "/tmp/logs.txt",
            maxBytes=5000000,
            backupCount=10,
        ),
        logging.StreamHandler(),
    ],
)

logging.getLogger("httpx").setLevel(logging.ERROR)
logging.getLogger("pyrogram").setLevel(logging.ERROR)
logging.getLogger("pytgcalls").setLevel(logging.ERROR)


def LOGGER(name: str) -> logging.Logger:
    return logging.getLogger(name)