aboutsummaryrefslogtreecommitdiff
path: root/brokenlinks/worker.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2026-01-22 01:51:52 +0700
committerShulhan <ms@kilabit.info>2026-01-22 01:51:52 +0700
commit2a4376d5ddeee82d4ef38f4953453abb43e85220 (patch)
treefd28f274ba9d0f06a69e4bc054b0443f7f4500d8 /brokenlinks/worker.go
parent79eaccc81b85eb92dab9cf18d52662f367903652 (diff)
downloadjarink-2a4376d5ddeee82d4ef38f4953453abb43e85220.tar.xz
brokenlinks: print the progress to stderr
Each time the scan start, new queue add, fetching start, print the message to stderr. This remove the verbose options for better user experience.
Diffstat (limited to 'brokenlinks/worker.go')
-rw-r--r--brokenlinks/worker.go10
1 files changed, 4 insertions, 6 deletions
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 {