Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion 02_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,24 @@ def process_customer(customer_id: str) -> str:
return f"Processed {customer_id}"


@flow
@flow(log_prints=True)
def main() -> list[str]:
"""
### 📊 Logging with Prefect

This flow demonstrates how to use the Prefect logger and capture standard output.
It processes customer data and logs progress at each step.

**Key Features:**
- Capture standard `print` statements as logs with `log_prints=True`.
- Use the Prefect logger for structured logging in tasks.
- Map tasks across a list of inputs.
"""
customer_ids = get_customer_ids()
# Map the process_customer task across all customer IDs
results = process_customer.map(customer_ids)

print(f"✅ Successfully processed {len(results)} customers with detailed logging!")
return results


Expand Down
Loading