stream_to_logger

config.isf_logging.stream_to_logger(logger, level=None)

Wrapper for a stream object that redirects writes to a logger instance. Can be used as a context manager:

>>> with StreamToLogger(logger, logging.INFO) as sys.stdout:
>>>    do_something()

Used for reading in .hoc files that provide output due to various print statements in the .hoc file, or capturing NEURON output.