mirror of
https://github.com/r4sas/py-i2phosts
synced 2025-01-24 05:25:03 +00:00
py-i2phosts-checker: configure logger using get_logger()
This commit is contained in:
parent
a461c3cbe9
commit
59254857ad
@ -37,15 +37,16 @@ else:
|
|||||||
sys.path.insert(1, DJANGO_PROJECT_PATH)
|
sys.path.insert(1, DJANGO_PROJECT_PATH)
|
||||||
os.environ['DJANGO_SETTINGS_MODULE'] = DJANGO_SETTINGS_MODULE
|
os.environ['DJANGO_SETTINGS_MODULE'] = DJANGO_SETTINGS_MODULE
|
||||||
from web.postkey.models import i2phost
|
from web.postkey.models import i2phost
|
||||||
|
from web.lib.utils import get_logger
|
||||||
|
|
||||||
# configure logger
|
# configure logger
|
||||||
log = logging.getLogger(sys.argv[0])
|
if args.debug == True:
|
||||||
handler = logging.StreamHandler()
|
log_level = 'debug'
|
||||||
log.addHandler(handler)
|
log_file = None
|
||||||
if args.debug:
|
|
||||||
log.setLevel(logging.DEBUG)
|
|
||||||
else:
|
else:
|
||||||
log.setLevel(logging.INFO)
|
log_level = config['log_level']
|
||||||
|
log_file = config['log_file']
|
||||||
|
log = get_logger(log_level=log_level)
|
||||||
|
|
||||||
all_hosts = i2phost.objects.all()
|
all_hosts = i2phost.objects.all()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user