diff --git a/logmagix/logger.py b/logmagix/logger.py index 6355afa..e2d33c7 100644 --- a/logmagix/logger.py +++ b/logmagix/logger.py @@ -111,9 +111,8 @@ def _log(self, level: LogLevel, message: str, start: int = None, end: int = None if not self._should_log(level): return - # Map log levels to colors and display names level_colors = { - LogLevel.DEBUG: self.BLUE, + LogLevel.DEBUG: self.YELLOW, LogLevel.INFO: self.CYAN, LogLevel.WARNING: self.YELLOW, LogLevel.SUCCESS: self.GREEN, @@ -122,7 +121,10 @@ def _log(self, level: LogLevel, message: str, start: int = None, end: int = None } color = level_colors.get(level, self.WHITE) - formatted_message = self.message3(f"{color}{level.name}", f"{color}{message}", start, end) + if level == LogLevel.DEBUG: + formatted_message = self.message3(f"{color}{level.name}", f"{self.GREEN}{message}", start, end) + else: + formatted_message = self.message3(f"{color}{level.name}", f"{color}{message}", start, end) with self.log_lock: print(formatted_message) diff --git a/setup.py b/setup.py index 24d9ca4..5f33ab3 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setup( name="logmagix", - version="2.0.0", + version="2.0.1", packages=find_packages(), install_requires=["colorama"], author="Sexfrance", diff --git a/test.log b/test.log new file mode 100644 index 0000000..4a88b41 --- /dev/null +++ b/test.log @@ -0,0 +1,18 @@ +2024-11-10 10:43:16,424 - DEBUG - [TestLogger] [10:43:16] [INFO] -> Starting test suite +2024-11-10 10:43:16,424 - NOTSET - [TestLogger] [10:43:16] [DEBUG] -> Debug information +2024-11-10 10:43:16,424 - INFO - [TestLogger] [10:43:16] [WARNING] -> Warning message +2024-11-10 10:43:16,425 - WARNING - [TestLogger] [10:43:16] [SUCCESS] -> Success message +2024-11-10 10:43:16,425 - ERROR - [TestLogger] [10:43:16] [ERROR] -> Failure message +2024-11-10 10:43:16,425 - DEBUG - [TestLogger] [10:43:16] [INFO] -> Testing log level filtering... +2024-11-10 10:43:16,427 - INFO - [TestLogger] [10:43:16] [WARNING] -> This warning message should appear +2024-11-10 10:43:16,427 - WARNING - [TestLogger] [10:43:16] [SUCCESS] -> This success message should appear +2024-11-10 10:43:16,427 - ERROR - [TestLogger] [10:43:16] [ERROR] -> This error message should appear +2024-11-10 10:43:16,428 - DEBUG - [TestLogger] [10:43:16] [INFO] -> Testing batch logging... +2024-11-10 10:43:16,428 - DEBUG - [TestLogger] [10:43:16] [INFO] -> Batch message 1 +2024-11-10 10:43:16,428 - WARNING - [TestLogger] [10:43:16] [SUCCESS] -> Batch success 1 +2024-11-10 10:43:16,429 - INFO - [TestLogger] [10:43:16] [WARNING] -> Batch warning 1 +2024-11-10 10:43:16,429 - ERROR - [TestLogger] [10:43:16] [ERROR] -> Batch failure 1 +2024-11-10 10:43:16,929 - DEBUG - [TestLogger] [10:43:16] [INFO] -> Batch message 2 +2024-11-10 10:43:16,929 - WARNING - [TestLogger] [10:43:16] [SUCCESS] -> Batch success 2 +2024-11-10 10:43:16,929 - INFO - [TestLogger] [10:43:16] [WARNING] -> Batch warning 2 +2024-11-10 10:43:16,929 - ERROR - [TestLogger] [10:43:16] [ERROR] -> Batch failure 2