Show detailed error statistics for -v (#1879)

This commit is contained in:
Soxoj
2024-11-24 04:21:24 +01:00
committed by GitHub
parent 3745711b12
commit 54fecccbfb
+8 -3
View File
@@ -44,7 +44,7 @@ from .settings import Settings
from .permutator import Permute from .permutator import Permute
def notify_about_errors(search_results: QueryResultWrapper, query_notify): def notify_about_errors(search_results: QueryResultWrapper, query_notify, show_statistics=False):
errs = errors.extract_and_group(search_results) errs = errors.extract_and_group(search_results)
was_errs_displayed = False was_errs_displayed = False
for e in errs: for e in errs:
@@ -58,12 +58,17 @@ def notify_about_errors(search_results: QueryResultWrapper, query_notify):
query_notify.warning(text, '!') query_notify.warning(text, '!')
was_errs_displayed = True was_errs_displayed = True
if show_statistics:
query_notify.warning(f'Verbose error statistics:')
for e in errs:
text = f'{e["err"]}: {round(e["perc"],2)}%'
query_notify.warning(text, '!')
if was_errs_displayed: if was_errs_displayed:
query_notify.warning( query_notify.warning(
'You can see detailed site check errors with a flag `--print-errors`' 'You can see detailed site check errors with a flag `--print-errors`'
) )
def extract_ids_from_page(url, logger, timeout=5) -> dict: def extract_ids_from_page(url, logger, timeout=5) -> dict:
results = {} results = {}
# url, headers # url, headers
@@ -670,7 +675,7 @@ async def main():
check_domains=args.with_domains, check_domains=args.with_domains,
) )
notify_about_errors(results, query_notify) notify_about_errors(results, query_notify, show_statistics=args.verbose)
if args.reports_sorting == "data": if args.reports_sorting == "data":
results = sort_report_by_data_points(results) results = sort_report_by_data_points(results)