logging to Updater added
This commit is contained in:
parent
aa33706f5b
commit
bc14b26a5f
@ -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:
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user