diff options
Diffstat (limited to 'brokenlinks')
| -rw-r--r-- | brokenlinks/brokenlinks_test.go | 7 | ||||
| -rw-r--r-- | brokenlinks/options.go | 2 | ||||
| -rw-r--r-- | brokenlinks/worker.go | 10 |
3 files changed, 6 insertions, 13 deletions
diff --git a/brokenlinks/brokenlinks_test.go b/brokenlinks/brokenlinks_test.go index a04be7f..eedad33 100644 --- a/brokenlinks/brokenlinks_test.go +++ b/brokenlinks/brokenlinks_test.go @@ -275,7 +275,6 @@ func TestScan(t *testing.T) { Url: testUrl, IgnoreStatus: `403`, Insecure: true, - IsVerbose: true, }, exp: map[string][]jarink.Link{ testUrl: []jarink.Link{ @@ -362,8 +361,7 @@ func TestScan(t *testing.T) { // pages other than below of "/page2" itself. desc: `With Url=/page2`, opts: brokenlinks.Options{ - Url: testUrl + `/page2`, - IsVerbose: true, + Url: testUrl + `/page2`, }, exp: map[string][]jarink.Link{ testUrl + `/page2`: []jarink.Link{ @@ -497,8 +495,7 @@ func TestScan_slow(t *testing.T) { } var opts = brokenlinks.Options{ - Url: testUrl, - IsVerbose: true, + Url: testUrl, } gotResult, err := brokenlinks.Scan(opts) if err != nil { diff --git a/brokenlinks/options.go b/brokenlinks/options.go index 2703f8d..e5f9fcf 100644 --- a/brokenlinks/options.go +++ b/brokenlinks/options.go @@ -27,8 +27,6 @@ type Options struct { IgnoreStatus string ignoreStatus []int - IsVerbose bool - // Insecure do not report error on server with invalid certificates. Insecure bool } diff --git a/brokenlinks/worker.go b/brokenlinks/worker.go index 07bda88..a286362 100644 --- a/brokenlinks/worker.go +++ b/brokenlinks/worker.go @@ -139,6 +139,7 @@ func (wrk *worker) scanAll() (result *Result, err error) { for x < len(wrk.queue) { linkq = wrk.queue[x] x++ + wrk.log.Printf(`scan %d/%d: %s`, x, len(wrk.queue), linkq.Url) resultq = wrk.scan(linkq) wrk.processResult(resultq) } @@ -202,6 +203,7 @@ func (wrk *worker) processResult(resultq map[string]jarink.Link) { continue } wrk.queue = append(wrk.queue, linkq) + wrk.log.Printf(`queue %d: %s`, len(wrk.queue), linkq.Url) } } @@ -327,14 +329,10 @@ func (wrk *worker) fetch(linkq jarink.Link) (httpResp *http.Response, err error) var retry int for retry < 5 { if linkq.Kind == int(atom.Img) { - if wrk.opts.IsVerbose { - wrk.log.Printf("fetch: HEAD %s", linkq.Url) - } + wrk.log.Printf("fetch: HEAD %s", linkq.Url) httpResp, err = wrk.httpc.Head(linkq.Url) } else { - if wrk.opts.IsVerbose { - wrk.log.Printf("fetch: GET %s", linkq.Url) - } + wrk.log.Printf("fetch: GET %s", linkq.Url) httpResp, err = wrk.httpc.Get(linkq.Url) } if err == nil { |
