From 89ea5720e53b37e5e19bde0eb54a7cb79af0dba6 Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Thu, 9 Mar 2023 22:56:24 +0100 Subject: [PATCH] add option quiet --- web_scrap.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/web_scrap.py b/web_scrap.py index c0b54ce..d52b90b 100644 --- a/web_scrap.py +++ b/web_scrap.py @@ -189,21 +189,21 @@ if __name__ == '__main__': parser.add_argument("--no-js", help="No JS", dest="js", action="store_true") parser.add_argument("--no-img", help="No img", dest="img", action="store_true") parser.add_argument("--no-html", help="No HTML", dest="html", action="store_true") - + parser.add_argument("--quiet", help="No console output", action="store_true") args = parser.parse_args() logger = logging.getLogger('web_scrap') - ch = logging.StreamHandler() - - if args.debug is True: - logger.setLevel(logging.DEBUG) - ch.setLevel(logging.DEBUG) - else: - logger.setLevel(logging.INFO) - ch.setLevel(logging.INFO) - formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') - ch.setFormatter(formatter) - logger.addHandler(ch) + + if args.quiet is False: + ch = logging.StreamHandler() + if args.debug is True: + logger.setLevel(logging.DEBUG) + ch.setLevel(logging.DEBUG) + else: + logger.setLevel(logging.INFO) + ch.setLevel(logging.INFO) + ch.setFormatter(formatter) + logger.addHandler(ch) if len(args.logfile) > 0: