Skip to content

Commit 688c3a2

Browse files
authored
Merge pull request #28 from yteraoka/log-read-bytes
body の byte 数を出力
2 parents 3fdb920 + 0062468 commit 688c3a2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

main.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,17 @@ func httpGet(reqUrl url.URL, thread, counter, total int) {
6767
io.Copy(io.Discard, resp.Body)
6868
resp.Body.Close()
6969
}()
70-
_, err = io.Copy(io.Discard, resp.Body)
70+
reads, err := io.Copy(io.Discard, resp.Body)
7171
if err != nil {
72-
log.Printf("[%03d-%05d] ERROR %s %s\n", thread, counter, err, urlStr)
72+
log.Printf("[%03d-%05d] ERROR read %d bytes, %s %s\n", thread, counter, reads, err, urlStr)
7373
}
7474
resp.Body.Close()
7575
end := time.Now()
7676
diff := end.Sub(start).Milliseconds()
7777
if diff > int64(opts.ShowThresholdMs) {
78-
log.Printf("[%03d-%05d] WARN %03d %5d ms %s\n", thread, counter, resp.StatusCode, diff, urlStr)
78+
log.Printf("[%03d-%05d] WARN %03d %5d ms, %d bytes, %s\n", thread, counter, resp.StatusCode, diff, reads, urlStr)
7979
} else if opts.Verbose {
80-
log.Printf("[%03d-%05d] INFO %03d %5d ms %s\n", thread, counter, resp.StatusCode, diff, urlStr)
80+
log.Printf("[%03d-%05d] INFO %03d %5d ms, %d bytes, %s\n", thread, counter, resp.StatusCode, diff, reads, urlStr)
8181
}
8282
if ! opts.Verbose && counter > 0 && counter % 100 == 0 {
8383
log.Printf("[%03d-%05d] INFO %d/%d requests finished\n", thread, counter, counter, total)

0 commit comments

Comments
 (0)