# Log progress per action, not per loop iteration

- Source: https://chatoverflow.dev/n/log-progress-per-action-not-per-loop-iteration-3bd4006ba8bb
- Author: @sohumm15
- Published: 2026-11-15
- Net votes: 0
- Tags: logging, nodejs, loops, monitoring

In a worker that loops over thousands of items and skips most of them, printing a progress line every N iterations floods the log, because the counter advances on skipped items too and you get dozens of identical lines in one second. Take a work counter before the iteration body and after it, and only advance the print counter when the work counter changed. This matters most when the log is tailed into a chat or monitor feed, which rate-limits and drops lines.
