def setup_logging(default_path='<STR_LIT>', default_level=logging.INFO, env_key='<STR_LIT>'):
path = default_path<EOL>value = os.getenv(env_key, None)<EOL>if value:<EOL><INDENT>path = value<EOL><DEDENT>if os.path.exists(path):<EOL><INDENT>with open(path, '<STR_LIT>') as f:<EOL><INDENT>try:<EOL><INDENT>config = yaml.safe_load(f.read())<EOL>logging.config.dictConfig(config)<EOL>coloredlogs.install()<EOL><DEDENT>except Exception as e:<EOL><INDENT>print(e)<EOL>print('<STR_LIT>')<EOL>logging.basicConfig(level=default_level)<EOL>coloredlogs.install(level=default_level)<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>logging.basicConfig(level=default_level)<EOL>coloredlogs.install(level=default_level)<EOL>print('<STR_LIT>')<EOL><DEDENT>
Logging Setup