LSSTApplications  20.0.0
LSSTDataManagementBasePackage
Functions
lsst.log.utils Namespace Reference

Functions

def traceSetAt (name, number)
 
def temporaryLogLevel (name, level)
 

Function Documentation

◆ 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 49 of file utils.py.

49 def temporaryLogLevel(name, level):
50  """A context manager that temporarily sets the level of a `Log`.
51 
52  Parameters
53  ----------
54  name : `str`
55  Name of the log to modify.
56  level : `int`
57  Integer enumeration constant indicating the temporary log level.
58  """
59  log = Log.getLogger(name)
60  old = log.getLevel()
61  log.setLevel(level)
62  try:
63  yield
64  finally:
65  log.setLevel(old)

◆ 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 32 of file utils.py.

32 def traceSetAt(name, number):
33  """Adjusts logging level to display messages with the trace number being
34  less than or equal to the provided value.
35 
36  Parameters
37  ----------
38  name : `str`
39  Name of the logger.
40  number : `int`
41  The trace number threshold for display.
42  """
43  for i in range(6):
44  level = Log.INFO if i > number else Log.DEBUG
45  Log.getLogger('TRACE%d.%s' % (i, name)).setLevel(level)
46 
47 
48 @contextmanager
lsst::log.utils.temporaryLogLevel
def temporaryLogLevel(name, level)
Definition: utils.py:49
lsst::log.log.logContinued.setLevel
def setLevel(loggername, level)
Definition: logContinued.py:174
lsst::log.utils.traceSetAt
def traceSetAt(name, number)
Definition: utils.py:32