def setup_logging(<EOL>default_level=logging.INFO,<EOL>default_path="<STR_LIT>".format(<EOL>os.getenv(<EOL>"<STR_LIT>",<EOL>os.path.dirname(os.path.realpath(__file__)))),<EOL>env_key="<STR_LIT>",<EOL>config_name=None):
path = default_path<EOL>file_name = default_path.split("<STR_LIT:/>")[-<NUM_LIT:1>]<EOL>if config_name:<EOL><INDENT>file_name = config_name<EOL><DEDENT>path = "<STR_LIT>".format(<EOL>"<STR_LIT:/>".join(default_path.split("<STR_LIT:/>")[:-<NUM_LIT:1>]),<EOL>file_name)<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>config = json.load(f)<EOL><DEDENT>logging.config.dictConfig(config)<EOL>return<EOL><DEDENT>else:<EOL><INDENT>cwd_path = os.getcwd() + "<STR_LIT>".format(<EOL>file_name)<EOL>if os.path.exists(cwd_path):<EOL><INDENT>with open(cwd_path, "<STR_LIT>") as f:<EOL><INDENT>config = json.load(f)<EOL><DEDENT>logging.config.dictConfig(config)<EOL>return<EOL><DEDENT>rels_path = os.getcwd() + "<STR_LIT>".format(<EOL>file_name)<EOL>if os.path.exists(rels_path):<EOL><INDENT>with open(rels_path, "<STR_LIT>") as f:<EOL><INDENT>config = json.load(f)<EOL><DEDENT>logging.config.dictConfig(config)<EOL>return<EOL><DEDENT>else:<EOL><INDENT>logging.basicConfig(level=default_level)<EOL>return<EOL><DEDENT><DEDENT>
setup_logging

    Setup logging configuration

    :param default_level: level to log
    :param default_path: path to config (optional)
    :param env_key: path to config in this env var
    :param config_name: filename for config