import json import logging import logging.config import os def setup_logging(default_path='log_config.json', default_level=logging.INFO, env_key='LOG_CFG', sms=True): """Setup logging configuration """ path = default_path value = os.getenv(env_key, None) if value: path = value if os.path.exists(path): with open(path, 'rt') as f: config = json.load(f) logging.config.dictConfig(config) else: logging.basicConfig(level=default_level) setup_logging() log_discord = logging.getLogger('discord') log_foBot = logging.getLogger('foBot') debug = log_foBot.debug info = log_foBot.info warning = log_foBot.warning error = log_foBot.error critical = log_foBot.critical