package round_trippers

import (
	"net/http"

	"github.com/rs/zerolog/log"
)

type LogRoundTripper struct {
	rt http.RoundTripper
}

func NewLogRoundTripper(rt http.RoundTripper) http.RoundTripper {
	return &LogRoundTripper{
		rt: rt,
	}
}

func (l *LogRoundTripper) RoundTrip(r *http.Request) (*http.Response, error) {
	log.Debug().Msgf("%s called", r.URL.String())

	return l.rt.RoundTrip(r)
}
