tcnksm / go-httpstat

Tracing golang HTTP request latency
MIT License
421 stars 72 forks source link

Implement `fmt.Formatter` #7

Closed tcnksm closed 7 years ago

tcnksm commented 7 years ago

Implement fmt.Formatter to display all stat information. Now you don't need to write each stats one by one. Just use %+v and it outputs all information,

fmt.Printf("%+v\n", result)

Output,

DNS lookup:         461 ms
TCP connection:     163 ms
TLS handshake:      427 ms
Server processing:  165 ms
Content transfer:     0 ms

Name Lookup:     461 ms
Connect:         624 ms
Pre Transfer:   1052 ms
Start Transfer: 1218 ms
Total:          1218 ms