

def get_log_stream(logger):
    '\n    Returns a stream to the root log file.\n    If there is no logfile return the stderr log stream\n\n    Returns:\n        A stream to the root log file or stderr stream.\n    '
    file_stream = None
    log_stream = None
    for handler in logger.handlers:
        if isinstance(handler, logging.FileHandler):
            file_stream = handler.stream
        else:
            log_stream = handler.stream
    if file_stream:
        return file_stream
    return log_stream

dataset/ETHPy150Open moonso/genmod/genmod/log.py get_log_stream/original