feat: improved logging with zerolog

This commit is contained in:
Nicolas Meienberger
2025-08-10 00:08:00 +02:00
parent d0bf890386
commit 18654426fa
14 changed files with 148 additions and 58 deletions

View File

@@ -3,18 +3,18 @@ package driver
import (
"encoding/json"
"ironmount/internal/db"
"log"
"net/http"
"github.com/rs/zerolog/hlog"
)
func Path(w http.ResponseWriter, r *http.Request) {
log.Printf("Received path request: %s", r.URL.Path)
var req PathRequest
_ = json.NewDecoder(r.Body).Decode(&req)
vol, err := db.GetVolumeByName(req.Name)
if err != nil {
hlog.FromRequest(r).Error().Err(err).Msg("Error retrieving volume")
_ = json.NewEncoder(w).Encode(map[string]string{
"Err": err.Error(),
})