diff --git a/main.go b/main.go index 08dba11..220c3e0 100644 --- a/main.go +++ b/main.go @@ -203,10 +203,11 @@ func pollSource(ctx context.Context, source string, interval time.Duration, cach func runOnce(ctx context.Context, source string, cacheDir string, agg *Aggregator, client *http.Client) { links, err := fetchSource(ctx, source, client) if err != nil { - log.Printf("poll %s: %v", source, err) + log.Printf("poll %s: failed - %v", source, err) return } if len(links) == 0 { + log.Printf("poll %s: success - 0 links", source) agg.Update(source, nil) if err := writeCache(cacheDir, source, nil); err != nil { log.Printf("write cache %s: %v", source, err) @@ -214,6 +215,7 @@ func runOnce(ctx context.Context, source string, cacheDir string, agg *Aggregato return } + log.Printf("poll %s: success - %d links", source, len(links)) agg.Update(source, links) if err := writeCache(cacheDir, source, links); err != nil { log.Printf("write cache %s: %v", source, err) @@ -240,6 +242,7 @@ func fetchSource(ctx context.Context, source string, client *http.Client) ([]str if resp.StatusCode < 200 || resp.StatusCode >= 300 { return nil, fmt.Errorf("unexpected status: %s", resp.Status) } + log.Printf("fetch %s: HTTP %d", source, resp.StatusCode) body, err := io.ReadAll(resp.Body) if err != nil { return nil, fmt.Errorf("read body: %w", err) @@ -254,6 +257,7 @@ func fetchSource(ctx context.Context, source string, client *http.Client) ([]str if err != nil { return nil, fmt.Errorf("read file: %w", err) } + log.Printf("fetch %s: file read %d bytes", source, len(data)) return normalizeLinks(string(data)), nil default: return nil, fmt.Errorf("unsupported source scheme: %s", u.Scheme)