File size: 402 Bytes
d46878a
 
 
 
1a38959
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
import logging

logger = logging.getLogger('demo')
logger.setLevel(logging.DEBUG)

stream_handler = logging.StreamHandler()
stream_handler.setLevel(logging.DEBUG)
logger.addHandler(stream_handler)

file_handler = logging.FileHandler('logs')
file_handler.setFormatter(logging.Formatter("%(asctime)s - %(filename)s:%(lineno)d - %(message)s", datefmt="%Y-%m-%d %H:%M:%S"))
logger.addHandler(file_handler)