func (c *Client) traceRequest(req *http.Request, url string) error {
	if !c.logger.IsTraceEnabled() {
		return nil
	}

	dump, err := httputil.DumpRequestOut(req, true)
	if err != nil {
		return errors.Trace(err)
	}
	c.logger.Tracef("request for %q: %q", url, dump)
	trace := &httptrace.ClientTrace{
		DNSStart: func(info httptrace.DNSStartInfo) {
			c.logger.Tracef("%s DNS Start: %q", url, info.Host)
		},
		DNSDone: func(dnsInfo httptrace.DNSDoneInfo) {
			c.logger.Tracef("%s DNS Info: %+v\n", url, dnsInfo)
		},
		ConnectDone: func(network, addr string, err error) {
			c.logger.Tracef("%s Connection Done: network %q, addr %q, err %q", url, network, addr, err)
		},
		GetConn: func(hostPort string) {
			c.logger.Tracef("%s Get Conn: %q", url, hostPort)
		},
		GotConn: func(connInfo httptrace.GotConnInfo) {
			c.logger.Tracef("%s Got Conn: %+v", url, connInfo)
		},
		TLSHandshakeStart: func() {
			c.logger.Tracef("%s TLS Handshake Start", url)
		},
		TLSHandshakeDone: func(st tls.ConnectionState, err error) {
			c.logger.Tracef("%s TLS Handshake Done: complete %t, verified chains %d, server name %q",
				url,
				st.HandshakeComplete,
				len(st.VerifiedChains),
				st.ServerName)
		},
	}
	*req = *req.WithContext(httptrace.WithClientTrace(req.Context(), trace))
	return nil
}
// traceRequest enabled debugging on the http request if
// log level for ths package is set to Trace.  Otherwise it
// returns with no change to the request.
traceRequest enabled debugging on the http request if
log level for ths package is set to Trace.  Otherwise it
returns with no change to the request.
// traceRequest enabled debugging on the http request if // log level for ths package is set to Trace . Otherwise it // returns with no change to the request .
func (c *Client) traceRequest(req *http.Request, url string) error {
	if !c.logger.IsTraceEnabled() {
		return nil
	}
	dump, err := httputil.DumpRequestOut(req, true)
	if err != nil {
		return errors.Trace(err)
	}
	c.logger.Tracef("request for %q: %q", url, dump)
	trace := &httptrace.ClientTrace{
		DNSStart: func(info httptrace.DNSStartInfo) {
			c.logger.Tracef("%s DNS Start: %q", url, info.Host)
		},
		DNSDone: func(dnsInfo httptrace.DNSDoneInfo) {
			c.logger.Tracef("%s DNS Info: %+v\n", url, dnsInfo)
		},
		ConnectDone: func(network, addr string, err error) {
			c.logger.Tracef("%s Connection Done: network %q, addr %q, err %q", url, network, addr, err)
		},
		GetConn: func(hostPort string) {
			c.logger.Tracef("%s Get Conn: %q", url, hostPort)
		},
		GotConn: func(connInfo httptrace.GotConnInfo) {
			c.logger.Tracef("%s Got Conn: %+v", url, connInfo)
		},
		TLSHandshakeStart: func() {
			c.logger.Tracef("%s TLS Handshake Start", url)
		},
		TLSHandshakeDone: func(st tls.ConnectionState, err error) {
			c.logger.Tracef("%s TLS Handshake Done: complete %t, verified chains %d, server name %q",
				url,
				st.HandshakeComplete,
				len(st.VerifiedChains),
				st.ServerName)
		},
	}
	*req = *req.WithContext(httptrace.WithClientTrace(req.Context(), trace))
	return nil
}
func ( c * Client ) traceRequest ( req * http . Request , url string ) error { if ! c . logger . IsTraceEnabled ( ) { return nil } dump , err := httputil . DumpRequestOut ( req , true ) if err != nil { return errors . Trace ( err ) } c . logger . Tracef ( " " , url , dump ) trace := & httptrace . ClientTrace { DNSStart : func ( info httptrace . DNSStartInfo ) { c . logger . Tracef ( " " , url , info . Host ) } , DNSDone : func ( dnsInfo httptrace . DNSDoneInfo ) { c . logger . Tracef ( " \n " , url , dnsInfo ) } , ConnectDone : func ( network , addr string , err error ) { c . logger . Tracef ( " " , url , network , addr , err ) } , GetConn : func ( hostPort string ) { c . logger . Tracef ( " " , url , hostPort ) } , GotConn : func ( connInfo httptrace . GotConnInfo ) { c . logger . Tracef ( " " , url , connInfo ) } , TLSHandshakeStart : func ( ) { c . logger . Tracef ( " " , url ) } , TLSHandshakeDone : func ( st tls . ConnectionState , err error ) { c . logger . Tracef ( " " , url , st . HandshakeComplete , len ( st . VerifiedChains ) , st . ServerName ) } , } * req = * req . WithContext ( httptrace . WithClientTrace ( req . Context ( ) , trace ) ) return nil }
traceRequest enabled debugging on the http request if
log level for ths package is set to Trace.
traceRequest enabled debugging on the http request if log level for ths package is set to Trace .