Files
oikos/vendor/github.com/openai/openai-go/option/middleware.go
dtoro febc153b7f
Some checks failed
ci / build-test (push) Has been cancelled
ci / docker-build (push) Has been cancelled
ci / web (push) Has been cancelled
Desktop App / Build Linux (amd64) (push) Has been cancelled
Desktop App / Attach to Release (push) Has been cancelled
fix: add involves edge from task to agent:nomos at creation
Plus sync vendor directory for Docker build compatibility.
2026-08-11 22:03:12 +02:00

39 lines
1017 B
Go

// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
package option
import (
"log"
"net/http"
"net/http/httputil"
)
// WithDebugLog logs the HTTP request and response content.
// If the logger parameter is nil, it uses the default logger.
//
// WithDebugLog is for debugging and development purposes only.
// It should not be used in production code. The behavior and interface
// of WithDebugLog is not guaranteed to be stable.
func WithDebugLog(logger *log.Logger) RequestOption {
return WithMiddleware(func(req *http.Request, nxt MiddlewareNext) (*http.Response, error) {
if logger == nil {
logger = log.Default()
}
if reqBytes, err := httputil.DumpRequest(req, true); err == nil {
logger.Printf("Request Content:\n%s\n", reqBytes)
}
resp, err := nxt(req)
if err != nil {
return resp, err
}
if respBytes, err := httputil.DumpResponse(resp, true); err == nil {
logger.Printf("Response Content:\n%s\n", respBytes)
}
return resp, err
})
}