Run library, checks and downloads in background threads with parallel fetching
This commit is contained in:
@@ -12,10 +12,33 @@ from src.constants import APP_TITLE
|
||||
from src.ui.main_window import MainWindow
|
||||
|
||||
|
||||
def _setup_logging(config_dir) -> None:
|
||||
"""Log DEBUG to stderr and to a rotating file for diagnostics."""
|
||||
log_file = config_dir / "gogupdater.log"
|
||||
logger.add(
|
||||
log_file,
|
||||
level="DEBUG",
|
||||
rotation="2 MB",
|
||||
retention=3,
|
||||
backtrace=True,
|
||||
diagnose=True,
|
||||
enqueue=True, # thread-safe logging from worker threads
|
||||
)
|
||||
logger.info(f"Logging to {log_file}")
|
||||
|
||||
# Make sure exceptions raised inside Qt slots are logged instead of swallowed.
|
||||
def _excepthook(exc_type, exc_value, exc_tb):
|
||||
logger.opt(exception=(exc_type, exc_value, exc_tb)).error("Uncaught exception")
|
||||
sys.__excepthook__(exc_type, exc_value, exc_tb)
|
||||
|
||||
sys.excepthook = _excepthook
|
||||
|
||||
|
||||
def main() -> None:
|
||||
config_dir = DEFAULT_CONFIG_DIR
|
||||
config_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
_setup_logging(config_dir)
|
||||
logger.info(f"Starting {APP_TITLE}")
|
||||
|
||||
auth = AuthManager(config_dir)
|
||||
|
||||
Reference in New Issue
Block a user