HTTP logger with slog
I wanted to create a logging middleware for HTTP client. Working code example you can find on GitHub The basic structure is type LoggingTransport struct { rt http.RoundTripper } func (t *LoggingTransport) RoundTrip(r *http.Request) (*http.Response, error) { // do before request is sent, ex. start timer, log request resp, err := t.rt.RoundTrip(r) // do after the response is received, ex. end timer, log response return resp, err } I found this code in Kubernetes source and I liked this implementation, I decided to adjust it to my needs....