mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-03-16 22:10:26 +00:00
Never log ignored warnings.
This commit is contained in:
parent
600b7c0e69
commit
bff217c58b
3 changed files with 8 additions and 11 deletions
|
|
@ -21,6 +21,8 @@ Changes:
|
|||
- logging: All sitemap loggers log all valid URLs regardless of the
|
||||
--warnings or --complete options. This way the sitemaps can be
|
||||
logged to file without changing the output of URLs in other loggers.
|
||||
- logging: Ignored warnings are now never logged, even when the URL
|
||||
has errors.
|
||||
|
||||
Fixes:
|
||||
- logging: Close logger properly on I/O errors.
|
||||
|
|
|
|||
|
|
@ -135,9 +135,6 @@ class UrlBase (object):
|
|||
"""
|
||||
self.base_ref = base_ref
|
||||
self.base_url = base_url.strip() if base_url else base_url
|
||||
if self.base_url != base_url:
|
||||
self.add_warning(_("Leading or trailing whitespace in URL `%(url)s'.") %
|
||||
{"url": base_url}, tag=WARN_URL_WHITESPACE)
|
||||
self.parent_url = parent_url
|
||||
self.recursion_level = recursion_level
|
||||
self.aggregate = aggregate
|
||||
|
|
@ -155,6 +152,9 @@ class UrlBase (object):
|
|||
url = absolute_url(self.base_url, base_ref, parent_url)
|
||||
# assume file link if no scheme is found
|
||||
self.scheme = url.split(":", 1)[0] or "file"
|
||||
if self.base_url != base_url:
|
||||
self.add_warning(_("Leading or trailing whitespace in URL `%(url)s'.") %
|
||||
{"url": base_url}, tag=WARN_URL_WHITESPACE)
|
||||
|
||||
def reset (self):
|
||||
"""
|
||||
|
|
@ -305,7 +305,8 @@ class UrlBase (object):
|
|||
Add a warning string.
|
||||
"""
|
||||
item = (tag, s)
|
||||
if item not in self.warnings:
|
||||
if item not in self.warnings and \
|
||||
tag not in self.aggregate.config["ignorewarnings"]:
|
||||
self.warnings.append(item)
|
||||
|
||||
def add_info (self, s):
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ class Logger (object):
|
|||
"""Initialize basic logging variables."""
|
||||
self.loggers = [config['logger']]
|
||||
self.loggers.extend(config['fileoutput'])
|
||||
self.ignorewarnings = config["ignorewarnings"]
|
||||
self.verbose = config["verbose"]
|
||||
self.complete = config["complete"]
|
||||
self.warnings = config["warnings"]
|
||||
|
|
@ -60,12 +59,7 @@ class Logger (object):
|
|||
return False
|
||||
if self.verbose:
|
||||
return True
|
||||
has_warnings = False
|
||||
for tag, dummy in url_data.warnings:
|
||||
if tag not in self.ignorewarnings:
|
||||
has_warnings = True
|
||||
break
|
||||
if self.warnings and has_warnings:
|
||||
if self.warnings and url_data.warnings:
|
||||
return True
|
||||
return not url_data.valid
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue