mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
pamhyr: Start switch to logging for program logs.
This commit is contained in:
1 parent
9b9ef8ee4b
commit
2f78432005
6 files changed
+55
-14
No files matched your search
+6
-3
@@ -2,6 +2,7 @@
|
||||
|
||||
import os
|
||||
import pickle
|
||||
import logging
|
||||
|
||||
from tools import SQL
|
||||
|
||||
@@ -13,13 +14,15 @@ from Solver.Solvers import solver_type_list
|
||||
config_dir = "/.cache/pamhyr/"
|
||||
config_file = "config.sqlite3"
|
||||
|
||||
logger = logging.getLogger()
|
||||
|
||||
class Config(SQL):
|
||||
def __init__(self):
|
||||
self._version = '0.0.1'
|
||||
self.filename = Config.filename()
|
||||
self.set_default_value()
|
||||
|
||||
print(self.filename)
|
||||
logging.info(f"Configuration file : {self.filename}")
|
||||
|
||||
super(Config, self).__init__(filename = self.filename)
|
||||
|
||||
@@ -61,10 +64,10 @@ class Config(SQL):
|
||||
self.commit()
|
||||
|
||||
def _update(self):
|
||||
version = self.execute(f"SELECT value FROM info WHERE key='version'")
|
||||
version = self.execute(f"SELECT value FROM info WHERE key='version'")[0]
|
||||
|
||||
if version != self._version:
|
||||
print("update")
|
||||
logger.info(f"Configuration file update from {version} to {self._version}...")
|
||||
|
||||
def _load_solver(self):
|
||||
self._solvers = []
|
||||
|
||||
Reference in new issue
Block a user