Skip to content

Commit 8480bb9

Browse files
committed
feat: Enhance display function with logging and summary of astronomical events
1 parent 2678d77 commit 8480bb9

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

src/sample_python_app/ui/display.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Handles formatting and displaying astronomical data using rich and pyfiglet."""
22

3-
from sample_python_app.core.config import settings
3+
from sample_python_app.core import settings, setup_logger
44
from sample_python_app.models import AstronomicalData, ForecastFeature
55

66
from .synthwave import synthwave_dashboard
@@ -11,4 +11,20 @@ def display_astronomical_data(astro: AstronomicalData, forecast: ForecastFeature
1111
1212
Combined synthwave dashboard will be shown.
1313
"""
14+
logger = setup_logger("normal")
15+
# Log plain-text summary for testability
16+
tz = settings.tz
17+
time_fmt = "%I:%M %p %Z"
18+
events = astro.formatted(tz, time_fmt)
19+
summary_keys = [
20+
"sunrise",
21+
"sunset",
22+
"astronomical_twilight_begin",
23+
"astronomical_twilight_end",
24+
]
25+
for key in summary_keys:
26+
value = events.get(key)
27+
if value:
28+
label = key.replace("_", " ").title()
29+
logger.info(f"{label}: {value}")
1430
synthwave_dashboard(astro, forecast, settings)

0 commit comments

Comments
 (0)