Fixed logging

This commit is contained in:
itdominator 2022-01-24 00:38:12 -06:00
parent 448ef61501
commit 00217b7a8e
3 changed files with 9 additions and 5 deletions

View File

@ -5,8 +5,8 @@ import os, logging
class Logger: class Logger:
def __init__(self): def __init__(config_path):
pass self._CONFIG_PATH = config_path
def get_logger(self, loggerName = "NO_LOGGER_NAME_PASSED", createFile = True): def get_logger(self, loggerName = "NO_LOGGER_NAME_PASSED", createFile = True):
""" """
@ -42,8 +42,8 @@ class Logger:
log.addHandler(ch) log.addHandler(ch)
if createFile: if createFile:
folder = "logs" folder = self._CONFIG_PATH
file = folder + "/application.log" file = f"{folder}/application.log"
if not os.path.exists(folder): if not os.path.exists(folder):
os.mkdir(folder) os.mkdir(folder)

View File

@ -26,7 +26,7 @@ class Settings:
self._WINDOW_ICON = f"{self._DEFAULT_ICONS}/{app_name.lower()}.png" self._WINDOW_ICON = f"{self._DEFAULT_ICONS}/{app_name.lower()}.png"
self._USR_PATH = f"/usr/share/{app_name.lower()}" self._USR_PATH = f"/usr/share/{app_name.lower()}"
self._logger = Logger().get_logger() self._logger = Logger(self._CONFIG_PATH).get_logger()
self._builder = Gtk.Builder() self._builder = Gtk.Builder()
self._main_window = None self._main_window = None
@ -42,6 +42,10 @@ class Settings:
self._warning_color = "#ffa800" self._warning_color = "#ffa800"
self._error_color = "#ff0000" self._error_color = "#ff0000"
if not os.path.exists(self._GLADE_FILE):
os.mkdir(self._CONFIG_PATH)
self._logger = Logger(self._CONFIG_PATH).get_logger()
if not os.path.exists(self._GLADE_FILE): if not os.path.exists(self._GLADE_FILE):
self._GLADE_FILE = f"{self._USR_PATH}/Main_Window.glade" self._GLADE_FILE = f"{self._USR_PATH}/Main_Window.glade"
if not os.path.exists(self._CSS_FILE): if not os.path.exists(self._CSS_FILE):

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB