Custom formatter to highlight model mappings
| 60 | |
| 61 | # Custom formatter for model mapping logs |
| 62 | class ColorizedFormatter(logging.Formatter): |
| 63 | """Custom formatter to highlight model mappings""" |
| 64 | |
| 65 | BLUE = "\033[94m" |
| 66 | GREEN = "\033[92m" |
| 67 | YELLOW = "\033[93m" |
| 68 | RED = "\033[91m" |
| 69 | RESET = "\033[0m" |
| 70 | BOLD = "\033[1m" |
| 71 | |
| 72 | def format(self, record): |
| 73 | if record.levelno == logging.debug and "MODEL MAPPING" in record.msg: |
| 74 | # Apply colors and formatting to model mapping logs |
| 75 | return f"{self.BOLD}{self.GREEN}{record.msg}{self.RESET}" |
| 76 | return super().format(record) |
| 77 | |
| 78 | |
| 79 | # Apply custom formatter to console handler |