Allow setting a logfile and a loglevel in tileserver

This commit is contained in:
Johan Van de Wauw 2018-02-01 11:02:32 +01:00 committed by Laura
parent 3061da63f5
commit ee88dc4f3d

View file

@ -17,11 +17,16 @@ from c3nav.mapdata.utils.cache import CachePackage
from c3nav.mapdata.utils.tiles import (build_access_cache_key, build_base_cache_key, build_tile_etag, get_tile_bounds,
parse_tile_access_cookie)
logging.basicConfig(level=logging.DEBUG if os.environ.get('C3NAV_DEBUG') else logging.INFO,
loglevel = logging.DEBUG if os.environ.get('C3NAV_DEBUG') else os.environ.get("LOGLEVEL","INFO")
logging.basicConfig(level=loglevel,
format='[%(asctime)s] [%(process)s] [%(levelname)s] %(name)s: %(message)s',
datefmt='%Y-%m-%d %H:%M:%S %z')
logger = logging.getLogger('c3nav')
if os.environ.get('C3NAV_LOGFILE'):
logging.basicConfig(filename=os.environ['C3NAV_LOGFILE'])
class TileServer:
def __init__(self):