Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Python3WebSpider/ProxyPool
Browse files Browse the repository at this point in the history
  • Loading branch information
Germey committed Mar 6, 2022
2 parents bd6c2fd + c683f82 commit 5d541d0
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions proxypool/setting.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
APP_PROD = IS_PROD = APP_ENV == PROD_MODE
APP_TEST = IS_TEST = APP_ENV == TEST_MODE


# Which WSGI container is used to run applications
# - gevent: pip install gevent
# - tornado: pip install tornado
Expand Down Expand Up @@ -86,5 +87,24 @@
ENABLE_GETTER = env.bool('ENABLE_GETTER', True)
ENABLE_SERVER = env.bool('ENABLE_SERVER', True)

# logger.add(env.str('LOG_RUNTIME_FILE', join(LOG_DIR, 'runtime.log')), level='DEBUG', rotation='1 week', retention='20 days')
# logger.add(env.str('LOG_ERROR_FILE', join(LOG_DIR, 'error.log')), level='ERROR', rotation='1 week')

ENABLE_LOG_FILE = env.bool('ENABLE_LOG_FILE', True)
ENABLE_LOG_RUNTIME_FILE = env.bool('ENABLE_LOG_RUNTIME_FILE', True)
ENABLE_LOG_ERROR_FILE = env.bool('ENABLE_LOG_ERROR_FILE', True)


LOG_LEVEL_MAP = {
DEV_MODE: "DEBUG",
TEST_MODE: "INFO",
PROD_MODE: "ERROR"
}

LOG_LEVEL = LOG_LEVEL_MAP.get(APP_ENV)

if ENABLE_LOG_FILE:
if ENABLE_LOG_RUNTIME_FILE:
logger.add(env.str('LOG_RUNTIME_FILE', join(LOG_DIR, 'runtime.log')),
level=LOG_LEVEL, rotation='1 week', retention='20 days')
if ENABLE_LOG_ERROR_FILE:
logger.add(env.str('LOG_ERROR_FILE', join(LOG_DIR, 'error.log')),
level='ERROR', rotation='1 week')

0 comments on commit 5d541d0

Please sign in to comment.