-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.py
More file actions
21 lines (15 loc) · 699 Bytes
/
utils.py
File metadata and controls
21 lines (15 loc) · 699 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import logging
import sys
from config import LOG_FILE
def setup_logger():
logger = logging.getLogger('NFTMonitor')
logger.setLevel(logging.INFO)
if not logger.handlers:
file_handler = logging.FileHandler(LOG_FILE, encoding='utf-8')
file_handler.setFormatter(logging.Formatter('%(asctime)s | %(levelname)s | %(message)s', datefmt='%Y-%m-%d %H:%M:%S'))
console_handler = logging.StreamHandler(sys.stdout)
console_handler.setFormatter(logging.Formatter('%(asctime)s | %(message)s', datefmt='%H:%M:%S'))
logger.addHandler(file_handler)
logger.addHandler(console_handler)
return logger
logger = setup_logger()