-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmain.py
More file actions
41 lines (32 loc) · 1.04 KB
/
main.py
File metadata and controls
41 lines (32 loc) · 1.04 KB
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
32
33
34
35
36
37
38
39
40
41
# main.py
import logging
import sys
import traceback
logging.basicConfig(
filename='app.log',
level=logging.INFO,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
)
console_handler = logging.StreamHandler()
console_handler.setLevel(logging.INFO)
console_handler.setFormatter(
logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
)
logging.getLogger().addHandler(console_handler)
logger = logging.getLogger(__name__)
def log_uncaught_exceptions(exctype, value, tb):
logger = logging.getLogger(__name__)
logger.error("Uncaught exception", exc_info=(exctype, value, tb))
sys.excepthook = log_uncaught_exceptions
from constant import DEBUG
from PySide6.QtWidgets import QApplication
from gui_classes.gui_manager.window_manager import WindowManager
def main():
if DEBUG:
logger.info("[MAIN] Starting application with debug mode enabled.")
app = QApplication(sys.argv)
manager = WindowManager()
manager.show()
sys.exit(app.exec())
if __name__ == "__main__":
main()