split status message prints

git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@2187 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
calvin 2005-01-20 22:52:58 +00:00
parent ffe2f1e896
commit 8e2b4edd49

View file

@ -27,8 +27,30 @@ except ImportError:
import linkcheck.threader
import linkcheck.log
import linkcheck.strformat
from urlbase import stderr
def print_tocheck (tocheck):
msg = _n("%5d URL queued,", "%5d URLs queued,", tocheck) % tocheck
print >> stderr, msg,
def print_links (links):
msg = _n("%4d URL checked,", "%4d URLs checked,", links) % links
print >> stderr, msg,
def print_active (active):
msg = _n("%2d active thread,", "%2d active threads,", active) % active
print >> stderr, msg,
def print_duration (duration):
msg = _("runtime %s") % linkcheck.strformat.strduration(duration)
print >> stderr, msg,
class Consumer (object):
"""
Consume urls from the url queue in a threaded manner.
@ -151,13 +173,13 @@ class Consumer (object):
"""
self.lock.acquire()
try:
print >> stderr, _("Status:"),
active = self.threader.active_threads()
links = self.linknumber
tocheck = self.cache.incoming_len()
duration = linkcheck.strformat.strduration(curtime - start_time)
print >> stderr, _("Status: %5d URLs queued, "
"%4d URLs checked, %2d active threads, runtime %s") % \
(tocheck, links, active, duration)
print_active(active)
print_links(self.linknumber)
print_tocheck(self.cache.incoming_len())
print_duration(curtime - start_time)
print >> stderr
finally:
self.lock.release()