@@ -39,9 +39,6 @@ bool fetchDepartures(JsonDocument &doc) {
3939 " /departures?lat=" + String (Config::getGeoLat ()) +
4040 " &lon=" + String (Config::getGeoLon ());
4141
42- Serial.print (" Fetching: " );
43- Serial.println (url);
44-
4542 // Log API request
4643 String logMsg = " API request: " + url;
4744 log (LOG_DEBUG , logMsg.c_str ());
@@ -67,20 +64,13 @@ bool fetchDepartures(JsonDocument &doc) {
6764 DeserializationError error = deserializeJson (doc, payload);
6865
6966 if (error) {
70- Serial.print (" JSON parse failed: " );
71- Serial.println (error.c_str ());
72-
7367 // Log JSON parse error
7468 String logMsg = " API JSON parse failed: " + String (error.c_str ());
7569 log (LOG_ERROR , logMsg.c_str ());
7670 } else {
77- Serial.println (" Successfully fetched departures" );
7871 success = true ;
7972 }
8073 } else {
81- Serial.print (" HTTP request failed, code: " );
82- Serial.println (httpCode);
83-
8474 // Log HTTP error with response body
8575 String responseBody = http.getString ();
8676 String logMsg = " API request failed: HTTP " + String (httpCode);
@@ -312,7 +302,12 @@ void setup(void) {
312302 localtime_r (&now, &timeinfo);
313303 Serial.print (" Current time: " );
314304 Serial.println (asctime (&timeinfo));
315- log (LOG_INFO , " NTP sync successful" );
305+
306+ // Log NTP sync with current time
307+ char timeStr[64 ];
308+ strftime (timeStr, sizeof (timeStr), " %Y-%m-%d %H:%M:%S %Z" , &timeinfo);
309+ String logMsg = String (" NTP sync successful: " ) + timeStr;
310+ log (LOG_INFO , logMsg.c_str ());
316311 }
317312
318313 // Initialize AWS IoT if enabled
@@ -360,9 +355,10 @@ void loop() {
360355
361356 JsonArray routes = globalDoc[" routes" ];
362357 totalRoutes = routes.size ();
363- Serial.print (" Total routes: " );
364- Serial.println (totalRoutes);
365- log (LOG_INFO , " Departures fetched successfully" );
358+
359+ // Log success with route count
360+ String logMsg = String (" Departures fetched successfully: " ) + String (totalRoutes) + " routes" ;
361+ log (LOG_INFO , logMsg.c_str ());
366362
367363 // Check if there's a message to display
368364 JsonArray message = globalDoc[" message" ];
@@ -379,11 +375,11 @@ void loop() {
379375 lastMessageTimeMs = millis ();
380376 log (LOG_INFO , " Message displayed" );
381377 } else {
382- Serial. print ( " Skipping message, elapsed: " );
383- Serial. print ( elapsed);
384- Serial. print ( " ms, interval: " );
385- Serial. print (Config::getMessageIntervalMs ());
386- Serial. println ( " ms " );
378+ // Log message skip
379+ String logMsg = String ( " Skipping message display, elapsed: " ) +
380+ String (elapsed) + " ms, interval: " +
381+ String (Config::getMessageIntervalMs ()) + " ms " ;
382+ log ( LOG_DEBUG , logMsg. c_str () );
387383 }
388384 }
389385 }
0 commit comments