20 lines
465 B
Python
20 lines
465 B
Python
# Load configuration yaml
|
|
|
|
import envyaml
|
|
import os
|
|
import logging
|
|
|
|
config = envyaml.EnvYAML(os.environ.get('CONFIG_PATH', 'config.yaml'))
|
|
|
|
def setLogLevel():
|
|
"""
|
|
Set the logging level based on the config
|
|
"""
|
|
logLevel = config["log.level"]
|
|
if logLevel == "info":
|
|
logging.basicConfig(level=logging.INFO)
|
|
elif logLevel == "debug":
|
|
logging.basicConfig(level=logging.DEBUG)
|
|
|
|
logging.warn("Logging level set to %s", logLevel)
|