LSST Applications  21.0.0-172-gfb10e10a+18fedfabac,22.0.0+297cba6710,22.0.0+80564b0ff1,22.0.0+8d77f4f51a,22.0.0+a28f4c53b1,22.0.0+dcf3732eb2,22.0.1-1-g7d6de66+2a20fdde0d,22.0.1-1-g8e32f31+297cba6710,22.0.1-1-geca5380+7fa3b7d9b6,22.0.1-12-g44dc1dc+2a20fdde0d,22.0.1-15-g6a90155+515f58c32b,22.0.1-16-g9282f48+790f5f2caa,22.0.1-2-g92698f7+dcf3732eb2,22.0.1-2-ga9b0f51+7fa3b7d9b6,22.0.1-2-gd1925c9+bf4f0e694f,22.0.1-24-g1ad7a390+a9625a72a8,22.0.1-25-g5bf6245+3ad8ecd50b,22.0.1-25-gb120d7b+8b5510f75f,22.0.1-27-g97737f7+2a20fdde0d,22.0.1-32-gf62ce7b1+aa4237961e,22.0.1-4-g0b3f228+2a20fdde0d,22.0.1-4-g243d05b+871c1b8305,22.0.1-4-g3a563be+32dcf1063f,22.0.1-4-g44f2e3d+9e4ab0f4fa,22.0.1-42-gca6935d93+ba5e5ca3eb,22.0.1-5-g15c806e+85460ae5f3,22.0.1-5-g58711c4+611d128589,22.0.1-5-g75bb458+99c117b92f,22.0.1-6-g1c63a23+7fa3b7d9b6,22.0.1-6-g50866e6+84ff5a128b,22.0.1-6-g8d3140d+720564cf76,22.0.1-6-gd805d02+cc5644f571,22.0.1-8-ge5750ce+85460ae5f3,master-g6e05de7fdc+babf819c66,master-g99da0e417a+8d77f4f51a,w.2021.48
LSST Data Management Base Package
Classes | Functions
lsst.log.utils Namespace Reference

Classes

class  LogRedirect
 

Functions

def traceSetAt (name, number)
 
def temporaryLogLevel (name, level)
 
def enable_notebook_logging (dest=sys.stderr)
 
def disable_notebook_logging ()
 

Function Documentation

◆ disable_notebook_logging()

def lsst.log.utils.disable_notebook_logging ( )
Stop notebook output for log4cxx messages.

Definition at line 147 of file utils.py.

148  """Stop notebook output for log4cxx messages."""
149  global _redirect
150  if _redirect is not None:
151  _redirect.finish()
152  _redirect = None
def disable_notebook_logging()
Definition: utils.py:147

◆ enable_notebook_logging()

def lsst.log.utils.enable_notebook_logging (   dest = sys.stderr)
Enable notebook output for log4cxx messages.

Definition at line 140 of file utils.py.

140 def enable_notebook_logging(dest=sys.stderr):
141  """Enable notebook output for log4cxx messages."""
142  global _redirect
143  if _redirect is None:
144  _redirect = LogRedirect(dest=dest)
145 
146 
def enable_notebook_logging(dest=sys.stderr)
Definition: utils.py:140

◆ temporaryLogLevel()

def lsst.log.utils.temporaryLogLevel (   name,
  level 
)
A context manager that temporarily sets the level of a `Log`.

Parameters
----------
name : `str`
    Name of the log to modify.
level : `int`
    Integer enumeration constant indicating the temporary log level.

Definition at line 58 of file utils.py.

58 def temporaryLogLevel(name, level):
59  """A context manager that temporarily sets the level of a `Log`.
60 
61  Parameters
62  ----------
63  name : `str`
64  Name of the log to modify.
65  level : `int`
66  Integer enumeration constant indicating the temporary log level.
67  """
68  log = Log.getLogger(name)
69  old = log.getLevel()
70  log.setLevel(level)
71  try:
72  yield
73  finally:
74  log.setLevel(old)
75 
76 
def temporaryLogLevel(name, level)
Definition: utils.py:58

◆ traceSetAt()

def lsst.log.utils.traceSetAt (   name,
  number 
)
Adjusts logging level to display messages with the trace number being
less than or equal to the provided value.

Parameters
----------
name : `str`
    Name of the logger.
number : `int`
    The trace number threshold for display.

Definition at line 41 of file utils.py.

41 def traceSetAt(name, number):
42  """Adjusts logging level to display messages with the trace number being
43  less than or equal to the provided value.
44 
45  Parameters
46  ----------
47  name : `str`
48  Name of the logger.
49  number : `int`
50  The trace number threshold for display.
51  """
52  for i in range(6):
53  level = Log.INFO if i > number else Log.DEBUG
54  Log.getLogger('TRACE%d.%s' % (i, name)).setLevel(level)
55 
56 
57 @contextmanager
def setLevel(loggername, level)
def traceSetAt(name, number)
Definition: utils.py:41