In page Console / Print

I am wondering if there is a way I can either re-direct stdout into the page, or alternatively have a way that i can create a textarea or iframe type widget where console type messages get printed.

My example is I am using fastai but the progress bar either outputs a jupyter widget or prints to the console. I have figured out I can override the print function with st.write but its a big ugly having that just getting dumped in the page.

for example:

import streamlit as st
import fastprogress


def log_fastai_msg(to_write, end=None, **kwargs):
    """log progress message from fastai"""
    st.write(to_write)
    if end:
        st.write(end)


fastprogress.fastprogress.WRITER_FN = log_fastai_msg

Does anyone have any other ways I can allow streamlit to support the ipython widgets or control the output of logged text in a nicer way?