def METHOD_NAME(path=None, io=False, level='INFO'):
    log = logging.getLogger('')
    if path:
        fp = open(path, 'w', 1)
        mitogen.core.set_cloexec(fp.fileno())
    else:
        fp = sys.stderr
    level = os.environ.get('MITOGEN_LOG_LEVEL', level).upper()
    io = level == 'IO'
    if io:
        level = 'DEBUG'
        logging.getLogger('mitogen.io').setLevel(level)
    level = getattr(logging, level, logging.INFO)
    log.setLevel(level)
    # Prevent accidental duplicate log_to_file() calls from generating
    # duplicate output.
    for handler_ in reversed(log.handlers):
        if getattr(handler_, 'is_mitogen', None):
            log.handlers.remove(handler_)
    handler = logging.StreamHandler(fp)
    handler.is_mitogen = True
    handler.formatter = log_get_formatter()
    log.handlers.insert(0, handler)