def get_log_stream(logger):

    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
Returns a stream to the root log file.
dataset/ETHPy150Open moonso/genmod/genmod/log.py/get_log_stream