diff options
author | lonkaars <loek@pipeframe.xyz> | 2021-04-25 14:04:10 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2021-04-25 14:04:10 +0200 |
commit | f020b861915d7269a44f73c417626879c8e0176b (patch) | |
tree | b5e9ef41c9db85da42743f3b98bbf464900cb756 /api/log.py | |
parent | 06f27a27404e43116bd3dada58fc60dfc3516d44 (diff) |
use debug/verbosity from .env in api
Diffstat (limited to 'api/log.py')
-rw-r--r-- | api/log.py | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -1,8 +1,18 @@ import logging +from dotenv import load_dotenv +from os import environ + +load_dotenv() # logging module wrapper (same as db.py) -VERBOSE = logging.INFO -logging.basicConfig(format="[ %(levelname)s ]: %(message)s", level=VERBOSE) +log_level = [ + None, + logging.ERROR, + logging.WARNING, + logging.INFO + ][int(environ["CONNECT4_LOG_LEVEL"])] + +logging.basicConfig(format="[ %(levelname)s ]: %(message)s", level=log_level) # log functions error = logging.error |