Merge pull request 'add option quiet' (#5) from quiet into master
Reviewed-on: #5
This commit is contained in:
commit
dfc9c4277b
24
web_scrap.py
24
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-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-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("--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()
|
args = parser.parse_args()
|
||||||
logger = logging.getLogger('web_scrap')
|
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')
|
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:
|
if len(args.logfile) > 0:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user