File size: 477 Bytes
d46878a
 
0f55f50
d46878a
1a38959
0f55f50
 
1a38959
 
0f55f50
1a38959
 
5b7f169
0f55f50
1a38959
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import logging

logger = logging.getLogger("guardian-demo")
logger.setLevel(logging.DEBUG)

formatter = logging.Formatter("%(asctime)s - %(filename)s:%(lineno)d - %(message)s", datefmt="%Y-%m-%d %H:%M:%S")

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

file_handler = logging.FileHandler("logs.txt")
file_handler.setFormatter(formatter)
logger.addHandler(file_handler)