Print summary of errors found.
(self)
| 426 | self.warnings.append(error_block) |
| 427 | |
| 428 | def print_summary(self) -> None: |
| 429 | """Print summary of errors found.""" |
| 430 | if not self.critical_errors and not self.warnings: |
| 431 | print("\n" + "=" * 80) |
| 432 | print("No errors found in logs!") |
| 433 | print("=" * 80) |
| 434 | return |
| 435 | |
| 436 | print("\n" + "=" * 80) |
| 437 | if self.critical_errors: |
| 438 | print(f"CRITICAL ERRORS: Found {len(self.critical_errors)} error(s)") |
| 439 | if self.warnings: |
| 440 | print(f"WARNINGS: Found {len(self.warnings)} warning(s)") |
| 441 | print("=" * 80 + "\n") |
| 442 | |
| 443 | # Show critical errors first |
| 444 | if self.critical_errors: |
| 445 | print("=" * 80) |
| 446 | print("CRITICAL ERRORS (Build Failures)") |
| 447 | print("=" * 80 + "\n") |
| 448 | for i, error in enumerate(self.critical_errors, 1): |
| 449 | print( |
| 450 | f"--- Critical Error {i}/{len(self.critical_errors)} in {error['job']} ---" |
| 451 | ) |
| 452 | print(error["content"]) |
| 453 | print() |
| 454 | |
| 455 | # Show warnings if no critical errors, or if there are few warnings |
| 456 | if self.warnings and (not self.critical_errors or len(self.warnings) <= 5): |
| 457 | print("=" * 80) |
| 458 | print("WARNINGS (Non-Critical)") |
| 459 | print("=" * 80 + "\n") |
| 460 | for i, warning in enumerate(self.warnings[:5], 1): |
| 461 | print( |
| 462 | f"--- Warning {i}/{min(len(self.warnings), 5)} in {warning['job']} ---" |
| 463 | ) |
| 464 | print(warning["content"]) |
| 465 | print() |
| 466 | if len(self.warnings) > 5: |
| 467 | print( |
| 468 | f"... and {len(self.warnings) - 5} more warnings (check log file for details)" |
| 469 | ) |
| 470 | print() |
| 471 | |
| 472 | def debug(self) -> None: |
| 473 | """Run the debugging process.""" |