-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlogs.py
31 lines (27 loc) · 979 Bytes
/
logs.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
"""This module is responsible for saving logs to the logs.log file."""
import logging
FILENAME = 'logs.log'
FORMAT = '%(levelname)s: %(asctime)s %(message)s'
def log_info(message: str) -> None:
"""
Logs info such as a new batch being added or new customer order
added.
"""
logging.basicConfig(filename=FILENAME, level=logging.DEBUG,
format=FORMAT)
logging.info(message)
def log_warning(message: str) -> None:
"""
logs warnings such as attempting to load an empty json file.
"""
logging.basicConfig(filename=FILENAME, level=logging.DEBUG,
format=FORMAT)
logging.warning(message)
def log_error(message: str) -> None:
"""
Logs known potential errors such as a RuntimeError while text to
speech is in use.
"""
logging.basicConfig(filename=FILENAME, level=logging.DEBUG,
format=FORMAT)
logging.error(message)