Skip to content

Commit

Permalink
Add a more generic API for notebook logging.
Browse files Browse the repository at this point in the history
  • Loading branch information
ktlim authored and timj committed Feb 2, 2019
1 parent a9eff0e commit 3f3249e
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions python/lsst/log/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,21 @@ def finish(self):
os.dup2(self._filehandle, self._fd)
os.close(self._filehandle)
self._thread.join()


_redirect = None


def enable_notebook_logging(dest=sys.stderr):
"""Enable notebook output for log4cxx messages."""
global _redirect
if _redirect is None:
_redirect = LogRedirect(dest=dest)


def disable_notebook_logging():
"""Stop notebook output for log4cxx messages."""
global _redirect
if _redirect is not None:
_redirect.finish()
_redirect = None

0 comments on commit 3f3249e

Please sign in to comment.