From bc14b26a5f3115d678f77e861d6109643f0c2f96 Mon Sep 17 00:00:00 2001 From: Dominik Demuth Date: Fri, 20 Jan 2023 18:25:29 +0100 Subject: [PATCH] logging to Updater added --- src/gui_qt/lib/utils.py | 8 ++++++++ src/nmreval/lib/logger.py | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/gui_qt/lib/utils.py b/src/gui_qt/lib/utils.py index e440bbf..322fa24 100644 --- a/src/gui_qt/lib/utils.py +++ b/src/gui_qt/lib/utils.py @@ -1,5 +1,6 @@ from __future__ import annotations +import sys from functools import lru_cache from os import getenv, stat from os.path import exists @@ -13,6 +14,8 @@ import requests from numpy import linspace from scipy.interpolate import interp1d +from nmreval.lib.logger import logger + from ..Qt import QtGui, QtWidgets, QtCore @@ -109,6 +112,7 @@ class UpdateDialog(QtWidgets.QDialog): self.setLayout(layout) def look_for_updates(self, filename=None): + logger.info(f'Looking for updates, compare to file {filename}') # Download zsync file of latest Appimage, look for SHA-1 hash and compare with hash of AppImage is_updateble, m_time_file, m_time_zsync = self.updater.get_update_information(filename) @@ -193,6 +197,7 @@ class Downloader(QtCore.QObject): @QtCore.pyqtSlot(list) def run_download(self, args: list[str]): + logger.info(f'Download with args {args}') process = subprocess.Popen(['zsync'] + args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, bufsize=1, universal_newlines=True) while True: nextline = process.stdout.readline().strip() @@ -268,6 +273,9 @@ class Updater: m_time_zsync, checksum_zsync, appname = Updater.get_zsync() m_time_file, checksum_file = Updater.get_appimage_info(filename) + logger.info(f'zsync information {m_time_zsync}, {checksum_zsync}, {appname}') + logger.info(f'file information {m_time_file}, {checksum_zsync}') + if not ((checksum_file is not None) and (checksum_zsync is not None)): return None, m_time_file, m_time_zsync else: diff --git a/src/nmreval/lib/logger.py b/src/nmreval/lib/logger.py index e920f8b..8ab8caf 100644 --- a/src/nmreval/lib/logger.py +++ b/src/nmreval/lib/logger.py @@ -7,7 +7,7 @@ ERROR_LOG = config_paths() / 'errors.log' # initialize logger stuff FORMAT = '%(asctime)s - %(levelname)s - %(name)s : %(message)s' DATEFMT = '%d/%m/%Y %H:%M:%S' -LEVEL = logging.ERROR +LEVEL = logging.INFO myformatter = logging.Formatter(fmt=FORMAT, datefmt=DATEFMT) logging.basicConfig(level=LEVEL, format=FORMAT, datefmt=DATEFMT)