summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Singleton <msingleton@aclu.org>2017-04-22 11:11:34 -0400
committerMatt Singleton <msingleton@aclu.org>2017-04-22 11:11:34 -0400
commit020c9908def3a816e05984c3ee55457fc423a931 (patch)
tree8eb39726eed506d6447318fc185830ad12e97cae
parent5cbce38c92953d24b48f714b1fc33d5cafdf874a (diff)
update command line arguments
-rwxr-xr-xunbiased/main.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/unbiased/main.py b/unbiased/main.py
index f81321e..caf77eb 100755
--- a/unbiased/main.py
+++ b/unbiased/main.py
@@ -48,11 +48,18 @@ logging_config = {
def main():
parser = argparse.ArgumentParser()
- parser.add_argument('-w', '--webroot', help='location of config file')
- parser.add_argument('-l', '--log-dir', help='location to write logs')
+ parser.add_argument('webroot', help='location to write html output')
+ parser.add_argument('-l', '--log-dir', help='location to write detailed logs')
+ parser.add_argument('-d', '--debug', action='store_true', help='run in debug mode')
args = parser.parse_args()
- logging_config['handlers']['file']['filename'] = os.path.join(args.log_dir, 'unbiased.debug.log')
+ if args.log_dir:
+ logging_config['handlers']['file']['filename'] = os.path.join(args.log_dir, 'unbiased.debug.log')
+ else:
+ logging_config['loggers']['unbiased']['handlers'].remove('file')
+ del logging_config['handlers']['file']
+ if args.debug:
+ logging_config['handlers']['console']['level'] = 'DEBUG'
logging.config.dictConfig(logging_config)
crawl_frequency = 600