Refactor logging setup across multiple modules to use loguru with consistent configuration

- Updated logging initialization in MessageCalendar, admin_edit_prof, elsa_main, graph, iconLine, searchPage, and richtext modules to use loguru.
- Changed log rotation and retention settings for log files to improve log management.
- Replaced logger.debug/info calls with log.debug/info for consistency.
- Fixed a typo in the searchPage UI and updated related references in the UI files.
- Removed unused imports and cleaned up code for better readability.
This commit is contained in:
2025-05-13 15:49:52 +02:00
parent 4a3a95623a
commit f7c499ea6e
32 changed files with 412 additions and 491 deletions

View File

@@ -1,27 +1,25 @@
import datetime
from dataclasses import dataclass
import loguru
import sys
from loguru import logger as log
logger = log
logger.remove()
logger.add("logs/application.log", rotation="1 week", retention="1 month", enqueue=True)
log = loguru.logger
log.remove()
log.add(sys.stdout)
log.add("logs/application.log", rotation="1 MB", retention="10 days")
# logger.add(sys.stderr, format="{time} {level} {message}", level="INFO")
logger.add(sys.stdout)
@dataclass
class Semester:
logger.debug("Semester class loaded")
log.debug("Semester class loaded")
_year: int | None = str(datetime.datetime.now().year)[2:]
_semester: str | None = None
_month: int | None = datetime.datetime.now().month
value: str = None
logger.debug(
log.debug(
f"Initialized Semester class with values: month: {_month}, semester: {_semester}, year {_year}"
)
@@ -45,7 +43,7 @@ class Semester:
else:
self._semester = "SoSe"
@logger.catch
@log.catch
def computeValue(self):
# year is only last two digits
year = self._year
@@ -57,7 +55,7 @@ class Semester:
valueyear = str(year) + "/" + str(year + 1)
self.value = f"{self._semester} {valueyear}"
@logger.catch
@log.catch
def offset(self, value: int) -> str:
"""Generate a new Semester object by offsetting the current semester by a given value