LogRedirect

class lsst.log.utils.LogRedirect(fd=1, dest=<_io.TextIOWrapper name='<stderr>' mode='w' encoding='utf-8'>, encoding='utf-8', errors='strict')

Bases: object

Redirect a logging file descriptor to a Python stream.

Parameters:
fdint

File descriptor number, usually 1 for standard out, the default log output location.

destio.TextIOBase

Destination text stream, often sys.stderr for ipython or Jupyter notebooks.

encodingstr

Text encoding of the data written to fd.

errorsstr

Encoding error handling.

Notes

Inspired by this Stack Overflow answer

Methods Summary

finish()

Stop redirecting output.

Methods Documentation

finish()

Stop redirecting output.