merging loglevel array to shared

This commit is contained in:
Peter Molnar 2017-07-05 21:09:06 +00:00
parent 68c796f924
commit ba08942632
3 changed files with 24 additions and 15 deletions

View file

@ -1969,15 +1969,8 @@ class NASG(object):
logging.root.removeHandler(logging.root.handlers[-1])
# --- set loglevel
llevel = {
'critical': 50,
'error': 40,
'warning': 30,
'info': 20,
'debug': 10
}
logging.basicConfig(
level=llevel[shared.config.get('params', 'loglevel')],
level=shared.LLEVEL[shared.config.get('params', 'loglevel')],
format='%(asctime)s - %(levelname)s - %(message)s'
)

21
pesos.py Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env python3
import json
import os
import hashlib
@ -12,8 +14,7 @@ import arrow
import bs4
from slugify import slugify
import oauth
from pprint import pprint
import argparse
""" TODO
@ -720,11 +721,21 @@ class DAFavs(Favs):
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Parameters for NASG')
parser.add_argument(
'--loglevel',
default='error',
help='change loglevel'
)
params = vars(parser.parse_args())
while len(logging.root.handlers) > 0:
logging.root.removeHandler(logging.root.handlers[-1])
logging.basicConfig(
level=10,
level=shared.LLEVEL[params.get('loglevel')],
format='%(asctime)s - %(levelname)s - %(message)s'
)
@ -742,7 +753,3 @@ if __name__ == '__main__':
da = DAFavs()
da.run()
#flickrfollow = FlickrFollowing()
#flickrfollow.run()

View file

@ -10,6 +10,15 @@ from whoosh import fields
from whoosh import analysis
from slugify import slugify
LLEVEL = {
'critical': 50,
'error': 40,
'warning': 30,
'info': 20,
'debug': 10
}
def __expandconfig(config):
""" add the dirs to the config automatically """
basepath = os.path.expanduser(config.get('common','base'))