- Simplified initialization logic in init.py - Consolidated testing_mode assignment - Removed unnecessary else statements - Created UIManager class to handle UI-related tasks - Modularized input frame creation, table frame creation, and graph frame creation - Enhanced edit window creation with better organization and error handling - Updated data management methods to improve clarity and maintainability - Improved logging for better debugging and tracking of application flow
27 lines
616 B
Python
27 lines
616 B
Python
import os
|
|
from logger import init_logger
|
|
from constants import LOG_PATH, LOG_CLEAR, LOG_LEVEL
|
|
|
|
if not os.path.exists(LOG_PATH):
|
|
os.mkdir(LOG_PATH)
|
|
|
|
log_files = (
|
|
f"{LOG_PATH}/app.log",
|
|
f"{LOG_PATH}/app.warning.log",
|
|
f"{LOG_PATH}/app.error.log",
|
|
)
|
|
|
|
testing_mode = LOG_LEVEL == "DEBUG"
|
|
|
|
logger = init_logger(__name__, testing_mode=testing_mode)
|
|
|
|
if LOG_CLEAR == "True":
|
|
try:
|
|
for log_file in log_files:
|
|
if os.path.exists(log_file):
|
|
with open(log_file, "r+") as t:
|
|
t.truncate(0)
|
|
except Exception as e:
|
|
logger.error(e)
|
|
raise
|