-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlog.py
31 lines (27 loc) · 1.4 KB
/
log.py
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
31
import logging
log_config = {
"MethodNotSupported" : {"level": 40,
"message": "Method not supported for more than one choice"},
"InvalidChoice": {"level": 40,
"message": "Choices doesn't have your current state"},
"NaN": {"level": 40,
"message": "You need to choose from available numbers 🔢 on board to mark your location"},
"OutOfRange": {"level": 40,
"message": "You can run but can't hide 👟, choose a number that is available"},
"Won": {"level": 20,
"message": "You have won this match 🏆, rematch?"},
"Tie": {"level": 20,
"message": "You've both outsmarted each other, 🤼 try again?"},
"End": {"level": 20,
"message": "Hope you had as much fun 👻, as I had while writing this."},
"Start": {"level": 20,
"message": "Match Started! 🏁"}
}
logging.basicConfig(filename="logfile.log",
format='%(asctime)s %(message)s',
filemode='w')
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
def log(case):
print(log_config[case]['message'])
logger.log(log_config[case]['level'], log_config[case]['message'])