From 8e2b4edd49d791df118dfadcb5c77fbced5beb3f Mon Sep 17 00:00:00 2001 From: calvin Date: Thu, 20 Jan 2005 22:52:58 +0000 Subject: [PATCH] split status message prints git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@2187 e7d03fd6-7b0d-0410-9947-9c21f3af8025 --- linkcheck/checker/consumer.py | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/linkcheck/checker/consumer.py b/linkcheck/checker/consumer.py index 11fca2e6..5a140321 100644 --- a/linkcheck/checker/consumer.py +++ b/linkcheck/checker/consumer.py @@ -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()