mirror of
https://github.com/chubin/wttr.in.git
synced 2024-11-07 08:44:23 +01:00
Split proxy access and errors logs
This commit is contained in:
parent
34684cb264
commit
8f433de15a
@ -37,12 +37,13 @@ MYDIR = os.path.abspath(
|
||||
sys.path.append("%s/lib/" % MYDIR)
|
||||
|
||||
import proxy_log
|
||||
from globals import PROXY_CACHEDIR, PROXY_HOST, PROXY_PORT, USE_METNO, USER_AGENT, MISSING_TRANSLATION_LOG, PROXY_LOG_FILE
|
||||
import globals
|
||||
from globals import PROXY_CACHEDIR, PROXY_HOST, PROXY_PORT, USE_METNO, USER_AGENT, MISSING_TRANSLATION_LOG
|
||||
from metno import create_standard_json_from_metno, metno_request
|
||||
from translations import PROXY_LANGS
|
||||
# pylint: enable=wrong-import-position
|
||||
|
||||
proxy_logger = proxy_log.LoggerWWO(PROXY_LOG_FILE)
|
||||
proxy_logger = proxy_log.LoggerWWO(globals.PROXY_LOG_ACCESS, globals.PROXY_LOG_ERRORS)
|
||||
|
||||
def is_testmode():
|
||||
"""Server is running in the wttr.in test mode"""
|
||||
@ -250,6 +251,7 @@ def _fetch_content_and_headers(path, query_string, **kwargs):
|
||||
try:
|
||||
data = json.loads(response.content)
|
||||
error = data.get("data", {}).get("error", "")
|
||||
if error:
|
||||
try:
|
||||
error = error[0]["msg"]
|
||||
except (ValueError, IndexError):
|
||||
|
@ -35,7 +35,9 @@ PNG_CACHE = os.path.join(_DATADIR, "cache/png")
|
||||
LRU_CACHE = os.path.join(_DATADIR, "cache/lru")
|
||||
|
||||
LOG_FILE = os.path.join(_LOGDIR, 'main.log')
|
||||
PROXY_LOG_FILE = os.path.join(_LOGDIR, 'proxy.log')
|
||||
|
||||
PROXY_LOG_ACCESS = os.path.join(_LOGDIR, 'proxy-access.log')
|
||||
PROXY_LOG_ERRORS = os.path.join(_LOGDIR, 'proxy-errors.log')
|
||||
|
||||
MISSING_TRANSLATION_LOG = os.path.join(_LOGDIR, 'missing-translation/%s.log')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user