Update main.go

This commit is contained in:
2025-09-23 22:58:14 +00:00
parent ae98c26d60
commit ddfe282ba7

View File

@@ -321,6 +321,10 @@ func gpsHandler(c *gin.Context) {
wg.Wait() wg.Wait()
// Log forwarding results
log.Printf("Dawarich forwarding: success=%t, error=%s", dawarichResult.Success, dawarichResult.Error)
log.Printf("HomeAssistant forwarding: success=%t, error=%s", haResult.Success, haResult.Error)
response := Response{ response := Response{
Timestamp: time.Now().Format(time.RFC3339), Timestamp: time.Now().Format(time.RFC3339),
ReceivedData: gpsData, ReceivedData: gpsData,
@@ -337,6 +341,9 @@ func gpsHandler(c *gin.Context) {
statusCode := http.StatusInternalServerError statusCode := http.StatusInternalServerError
if dawarichResult.Success || haResult.Success { if dawarichResult.Success || haResult.Success {
statusCode = http.StatusOK statusCode = http.StatusOK
log.Printf("GPS data processed successfully (status=%d)", statusCode)
} else {
log.Printf("All forwarding services failed, returning status=%d", statusCode)
} }
c.JSON(statusCode, response) c.JSON(statusCode, response)