Skip to content

Commit e1dce3d

Browse files
committed
Better logs for HTTP and MQTT requests
1 parent c11972d commit e1dce3d

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

http.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ func handleOCR(w http.ResponseWriter, r *http.Request) {
3838
}
3939
defer r.Body.Close()
4040

41+
log.Printf("OCR request received: image_bytes=%d bat_level=%d bat_voltage=%d", len(imageData), batLevel, batVoltage)
42+
4143
if len(imageData) == 0 {
4244
http.Error(w, "empty body", http.StatusBadRequest)
4345
return

mqtt.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,4 +160,5 @@ func publish(topic, payload string, retain bool) {
160160
if token.Error() != nil {
161161
log.Printf("MQTT publish error (%s): %v", topic, token.Error())
162162
}
163+
log.Printf("MQTT published payload %s to %s with retain=%v", payload, topic, retain)
163164
}

0 commit comments

Comments
 (0)