Merge pull request #648 from eht16/adjustable_log_level

Introduce PDNS_ADMIN_LOG_LEVEL to change the log level
This commit is contained in:
Khanh Ngo 2020-01-29 22:28:03 +07:00 committed by GitHub
commit a069fdd8cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,8 +13,12 @@ def create_app(config=None):
from .assets import assets from .assets import assets
app = Flask(__name__) app = Flask(__name__)
# Read log level from environment variable
log_level_name = os.environ.get('PDNS_ADMIN_LOG_LEVEL', 'WARNING')
log_level = logging.getLevelName(log_level_name.upper())
# Setting logger # Setting logger
logging.basicConfig( logging.basicConfig(
level=log_level,
format= format=
"[%(asctime)s] [%(filename)s:%(lineno)d] %(levelname)s - %(message)s") "[%(asctime)s] [%(filename)s:%(lineno)d] %(levelname)s - %(message)s")