Demonstrate progress tracking with logging.
()
| 97 | |
| 98 | |
| 99 | def demo_progress_tracking(): |
| 100 | """Demonstrate progress tracking with logging.""" |
| 101 | print("=" * 60) |
| 102 | print("PROGRESS TRACKING EXAMPLE") |
| 103 | print("=" * 60) |
| 104 | |
| 105 | total_items = 5 |
| 106 | info(f"Processing {total_items} items") |
| 107 | |
| 108 | for i in range(1, total_items + 1): |
| 109 | step(f"Processing item {i}/{total_items}") |
| 110 | time.sleep(0.2) # Simulate work |
| 111 | |
| 112 | if i == 3: |
| 113 | warn(f"Item {i} required additional validation") |
| 114 | |
| 115 | ok(f"Item {i} completed") |
| 116 | dim(f" Progress: {i}/{total_items} ({i / total_items * 100:.0f}%)") |
| 117 | |
| 118 | ok("All items processed successfully") |
| 119 | |
| 120 | print() |
| 121 | |
| 122 | |
| 123 | def demo_error_scenarios(): |