change to use logging level in config instead of deriving it from verbose

fix merge conflicts

remove verbose config option

set default config option for log level

change name of the config option to what it is instead of the level name
pull/138/head
Hayden King 6 years ago
parent f4a5b67ceb
commit e49ec19983

@ -1,16 +1,3 @@
<<<<<<< HEAD
arrow==0.9.0
decorator==4.0.10
praw==4.2.0
PyYAML==3.12
requests==2.12.1
six==1.10.0
backports-abc==0.4
tornado==4.3
update-checker==0.15
wheel==0.24.0
appdirs==1.4.3
=======
appdirs==1.4.3 appdirs==1.4.3
arrow==0.10.0 arrow==0.10.0
backports-abc==0.5 backports-abc==0.5
@ -27,4 +14,3 @@ six==1.10.0
tornado==4.5.1 tornado==4.5.1
update-checker==0.16 update-checker==0.16
urllib3==1.21.1 urllib3==1.21.1
>>>>>>> 772df35c68a6782b2bd733801458023545977166

@ -1,6 +1,5 @@
default_config = {"username": None, default_config = {"username": None,
"password": None, "password": None,
"verbose": True,
"save_directory": "/tmp", "save_directory": "/tmp",
"whitelist": [], "whitelist": [],
"whitelist_ids": [], "whitelist_ids": [],
@ -18,5 +17,6 @@ default_config = {"username": None,
"trial_run": False, "trial_run": False,
"clear_vote": False, "clear_vote": False,
"replacement_format": "random", "replacement_format": "random",
"log_level": "DEBUG",
"edit_only": False, "edit_only": False,
"batch_cooldown": 10} "batch_cooldown": 10}

@ -21,7 +21,7 @@ class Shredder(object):
def __init__(self, config, user): def __init__(self, config, user):
logging.basicConfig() logging.basicConfig()
self._logger = logging.getLogger("shreddit") self._logger = logging.getLogger("shreddit")
self._logger.setLevel(level=logging.DEBUG if config.get("verbose", True) else logging.INFO) self._logger.setLevel(level=config.get("log_level", 'DEBUG').upper())
self.__dict__.update({"_{}".format(k): config[k] for k in config}) self.__dict__.update({"_{}".format(k): config[k] for k in config})
self._user = user self._user = user

@ -13,9 +13,6 @@ max_score: 100
# Options: new, top, controversial, more? # Options: new, top, controversial, more?
sort: new sort: new
# Enables print statements to notify you of what's going on
verbose: True
# Removes your vote before deleting the item # Removes your vote before deleting the item
clear_vote: False clear_vote: False
@ -67,9 +64,9 @@ save_directory: /tmp
# options: [random, dot, "user entered string"] # options: [random, dot, "user entered string"]
replacement_format: random replacement_format: random
# Debug level, how much output you want # Logging level, how much output you want
# See: https://docs.python.org/3/library/logging.html#logging-levels # See: https://docs.python.org/3/library/logging.html#logging-levels
debug: DEBUG log_level: DEBUG
# Define your own wordlist to use as substitution text when # Define your own wordlist to use as substitution text when
# replacement_format == random # replacement_format == random

Loading…
Cancel
Save