Don't show server output
This commit is contained in:
parent
eae8a1bde4
commit
bff44a7461
@ -1,17 +1,6 @@
|
||||
import logging
|
||||
import sys
|
||||
from io import StringIO
|
||||
|
||||
|
||||
def on_server_loaded(_server_context):
|
||||
formatter = logging.Formatter(
|
||||
fmt="%(asctime)s %(levelname)s: %(message)s", datefmt="%Y-%m-%d %H:%M:%S"
|
||||
)
|
||||
|
||||
sys.stdout = StringIO()
|
||||
|
||||
bokeh_handler = logging.StreamHandler(StringIO())
|
||||
bokeh_handler.setFormatter(formatter)
|
||||
bokeh_logger = logging.getLogger("bokeh")
|
||||
bokeh_logger.setLevel(logging.WARNING)
|
||||
bokeh_logger.addHandler(bokeh_handler)
|
||||
|
@ -1,5 +1,4 @@
|
||||
import argparse
|
||||
import logging
|
||||
import sys
|
||||
|
||||
from bokeh.io import curdoc
|
||||
@ -43,11 +42,7 @@ doc.anatric_path = args.anatric_path
|
||||
doc.spind_path = args.spind_path
|
||||
doc.sxtal_refgen_path = args.sxtal_refgen_path
|
||||
|
||||
# In app_hooks.py a StreamHandler was added to "bokeh" logger
|
||||
bokeh_stream = logging.getLogger("bokeh").handlers[0].stream
|
||||
|
||||
log_textareainput = TextAreaInput(title="Logging output:")
|
||||
bokeh_log_textareainput = TextAreaInput(title="Server output:")
|
||||
|
||||
|
||||
def proposal_textinput_callback(_attr, _old, _new):
|
||||
@ -94,14 +89,13 @@ doc.add_root(
|
||||
panel_spind.create(),
|
||||
]
|
||||
),
|
||||
row(log_textareainput, bokeh_log_textareainput, sizing_mode="scale_both"),
|
||||
row(log_textareainput, sizing_mode="scale_both"),
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def update_stdout():
|
||||
log_textareainput.value = sys.stdout.getvalue()
|
||||
bokeh_log_textareainput.value = bokeh_stream.getvalue()
|
||||
|
||||
|
||||
doc.add_periodic_callback(update_stdout, 1000)
|
||||
|
Loading…
x
Reference in New Issue
Block a user