From 99b87aeffb9412ad7a0cc1f795fd6af89cf4eb76 Mon Sep 17 00:00:00 2001 From: ryuslash Date: Wed, 21 Apr 2010 15:40:20 +0200 Subject: Log function works, need to start using it now --- 4grab.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to '4grab.py') diff --git a/4grab.py b/4grab.py index 367cc04..c728dfc 100755 --- a/4grab.py +++ b/4grab.py @@ -25,6 +25,7 @@ import os import config from util import raw_input_with_default +import util import download import progressbar @@ -110,6 +111,12 @@ under certain conditions.""") dest="sort", help="Sort downloaded images, most handy if you've used " "older versions which didn't sort yet") + parser.add_option("-l", + "--loglevel", + nargs=1, + dest="loglevel", + metavar="LEVEL", + help="Changes the default log level to LEVEL") (options, args) = parser.parse_args() if options.confval and (options.tempcat @@ -175,8 +182,9 @@ under certain conditions.""") elif options.tempcat: conf.set_categories([options.tempcat]) -#base_url = "%s%s/" % (base_url, conf.get_categories()) - + elif options.loglevel is not None: + util.loglevel = util.LogType.from_int(options.loglevel) + if __name__ == "__main__": conf = config.Configuration() sort = sorter.Sorter() @@ -196,3 +204,4 @@ if __name__ == "__main__": except KeyboardInterrupt: print print "So you don't want these images? Fine! I'll stop then." + util.log(util.LogType.Err, "Quit on user request") -- cgit v1.2.3-54-g00ecf