mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-04-23 23:54:44 +00:00
Don't print cached errors or warnings unless verbose output is requested.
git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@3640 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
parent
204dd8c2c3
commit
ad7c9bbc76
6 changed files with 34 additions and 15 deletions
|
|
@ -91,6 +91,12 @@
|
|||
Type: feature
|
||||
Changed: linkcheck/cookies.py
|
||||
|
||||
* Don't print cached errors or warnings unless verbose output is
|
||||
requested.
|
||||
Type: feature
|
||||
Changed: linkcheck/director/logger.py,
|
||||
linkcheck/logger/{__init__,html,text}.py
|
||||
|
||||
4.7 "300" (released 17.6.2007)
|
||||
|
||||
* Mention in the documentation that --anchors enables logging of
|
||||
|
|
|
|||
4
TODO
4
TODO
|
|
@ -1,7 +1,3 @@
|
|||
- [INTERFACE] Reporting cached results is duplicate info. Better let the
|
||||
first encountered warning or error be reported, and skip the other ones
|
||||
unless --verbose is given.
|
||||
|
||||
- [BUG REPORT] the web interface only runs on the server it is installed on.
|
||||
The ALLOWED_HOSTS and ALLOWED_SERVERS variables in lc.cgi don't work and
|
||||
are not (well) documented.
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ class Logger (object):
|
|||
if tag not in self.ignorewarnings:
|
||||
has_warnings = True
|
||||
break
|
||||
do_print = self.verbose or not url_data.valid or \
|
||||
(has_warnings and self.warnings)
|
||||
do_print = self.verbose or not (url_data.cached or
|
||||
(url_data.valid and not (has_warnings and self.warnings)))
|
||||
for log in self.logs:
|
||||
log.log_filter_url(url_data, do_print)
|
||||
|
|
|
|||
|
|
@ -69,8 +69,12 @@ class Logger (object):
|
|||
self.number = 0
|
||||
# number of encountered errors
|
||||
self.errors = 0
|
||||
# number of encountered warningss
|
||||
# number of errors that were printed
|
||||
self.errors_printed = 0
|
||||
# number of warnings
|
||||
self.warnings = 0
|
||||
# number of warnings that were printed
|
||||
self.warnings_printed = 0
|
||||
# encoding of output
|
||||
default = linkcheck.i18n.default_encoding
|
||||
self.output_encoding = args.get("encoding", default)
|
||||
|
|
@ -233,8 +237,12 @@ class Logger (object):
|
|||
self.number += 1
|
||||
if not url_data.valid:
|
||||
self.errors += 1
|
||||
self.warnings += len(url_data.warnings)
|
||||
if do_print:
|
||||
self.errors_printed += 1
|
||||
num_warnings = len(url_data.warnings)
|
||||
self.warnings += num_warnings
|
||||
if do_print:
|
||||
self.warnings_printed += num_warnings
|
||||
self.log_url(url_data)
|
||||
|
||||
@linkcheck.decorators.notimplemented
|
||||
|
|
|
|||
|
|
@ -282,11 +282,16 @@ class HtmlLogger (linkcheck.logger.Logger):
|
|||
self.write(_n("%d link checked.", "%d links checked.",
|
||||
self.number) % self.number)
|
||||
self.write(u" ")
|
||||
self.write(_n("%d warning found.", "%d warnings found.",
|
||||
self.write(_n("%d warning found", "%d warnings found",
|
||||
self.warnings) % self.warnings)
|
||||
self.write(u" ")
|
||||
self.writeln(_n("%d error found.", "%d errors found.",
|
||||
if self.warnings != self.warnings_printed:
|
||||
self.write(_(", %d printed") % self.warnings_printed)
|
||||
self.write(u". ")
|
||||
self.write(_n("%d error found", "%d errors found",
|
||||
self.errors) % self.errors)
|
||||
if self.errors != self.errors_printed:
|
||||
self.write(_(", %d printed") % self.errors_printed)
|
||||
self.writeln(u".")
|
||||
self.writeln(u"<br>")
|
||||
self.stoptime = time.time()
|
||||
duration = self.stoptime - self.starttime
|
||||
|
|
|
|||
|
|
@ -244,12 +244,16 @@ class TextLogger (linkcheck.logger.Logger):
|
|||
self.write(_n("%d link checked.", "%d links checked.",
|
||||
self.number) % self.number)
|
||||
self.write(u" ")
|
||||
|
||||
self.write(_n("%d warning found.", "%d warnings found.",
|
||||
self.write(_n("%d warning found", "%d warnings found",
|
||||
self.warnings) % self.warnings)
|
||||
self.write(u" ")
|
||||
self.writeln(_n("%d error found.", "%d errors found.",
|
||||
if self.warnings != self.warnings_printed:
|
||||
self.write(_(", %d printed") % self.warnings_printed)
|
||||
self.write(u". ")
|
||||
self.write(_n("%d error found", "%d errors found",
|
||||
self.errors) % self.errors)
|
||||
if self.errors != self.errors_printed:
|
||||
self.write(_(", %d printed") % self.errors_printed)
|
||||
self.writeln(u".")
|
||||
self.stoptime = time.time()
|
||||
duration = self.stoptime - self.starttime
|
||||
self.writeln(_("Stopped checking at %(time)s (%(duration)s)") %
|
||||
|
|
|
|||
Loading…
Reference in a new issue