File size: 530 Bytes
4b0118c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import logging
import os,sys

logging_str="[%(asctime)s: %(levelname)s: %(module)s]: %(message)s"

log_dir = "logs"

log_file_path = os.path.join(log_dir,"running_logs.log")

os.makedirs(log_dir, exist_ok=True)

logging.basicConfig(level=logging.INFO, format=logging_str,
                    handlers=[
                        logging.FileHandler(log_file_path),
                        logging.StreamHandler(sys.stdout)  # to display the logger messages in command prompt
                    ])

logger = logging.getLogger("Bot")