-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.py
28 lines (22 loc) · 961 Bytes
/
init.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
"""
This file is responsible for managing crucial program settings and configurations.
(Import and use this file at the program's starting point for essential configurations)
"""
import logging as log
import logging.config as log_conf
from configparser import ConfigParser
# Configuration paths
PATH = {
'log': 'logs/general.log',
'conf': {
'general': 'confs/general.ini',
'logging': 'confs/logging.ini'
}
}
try:
conf = ConfigParser() # Initialize the ConfigParser
conf.read(filenames=PATH['conf']['general']) # Read the general configuration file
log_conf.fileConfig(fname=PATH['conf']['logging'], defaults={'filename': PATH['log']}) # Configure logging based on the logging configuration file
except Exception:
log.critical("During the execution of the program in the 'init file', an issue was encountered.", exc_info=True)
raise SystemExit("Exception: 'init file', More information in the log file.")