未验证 提交 cdb30bbb 编写于 作者: B Bin Long 提交者: GitHub

Merge pull request #154 from ShenYuhan/develop

add log level default value
......@@ -24,7 +24,6 @@ import requests
import json
import yaml
import random
import fcntl
from random import randint
from paddlehub.common import utils, srv_utils
......@@ -39,9 +38,6 @@ CACHE_TIME = 60 * 10
class HubServer(object):
def __init__(self, config_file_path=None):
LOCK_FILE = os.path.join(hub.HUB_HOME, '__LOCK__')
LOCK_FP = open(LOCK_FILE, 'a+')
fcntl.flock(LOCK_FP.fileno(), fcntl.LOCK_EX)
if not config_file_path:
config_file_path = os.path.join(hub.CONF_HOME, 'config.json')
if not os.path.exists(hub.CONF_HOME):
......@@ -57,7 +53,6 @@ class HubServer(object):
self.server_url = self.config['server_url']
self.request()
self._load_resource_list_file_if_valid()
LOCK_FP.close()
def get_server_url(self):
random.seed(int(time.time()))
......
......@@ -43,7 +43,7 @@ class Logger(object):
self.logger.setLevel(self._get_logging_level())
if os.path.exists(os.path.join(CONF_HOME, "config.json")):
with open(os.path.join(CONF_HOME, "config.json"), "r") as fp:
level = json.load(fp).get("log_level")
level = json.load(fp).get("log_level", "DEBUG")
self.logLevel = level
self.setLevel(level)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册