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 | Variables
lsst.log.log.logContinued Namespace Reference

Classes

class  Log
 
class  MDCDict
 
class  UsePythonLogging
 
class  LevelTranslator
 
class  LogHandler
 

Functions

def configure (*args)
 
def configure_prop (properties)
 
def configure_pylog_MDC (str level, Optional[type] MDC_class=MDCDict)
 
def getDefaultLogger ()
 
def getLogger (loggername)
 
def MDC (key, value)
 
def MDCRemove (key)
 
def MDCRegisterInit (func)
 
def setLevel (loggername, level)
 
def getLevel (loggername)
 
def getEffectiveLevel (loggername)
 
def isEnabledFor (loggername, level)
 
def log (loggername, level, fmt, *args, **kwargs)
 
def trace (fmt, *args)
 
def debug (fmt, *args)
 
def info (fmt, *args)
 
def warn (fmt, *args)
 
def warning (fmt, *args)
 
def error (fmt, *args)
 
def fatal (fmt, *args)
 
def critical (fmt, *args)
 
def logf (loggername, level, fmt, *args, **kwargs)
 
def tracef (fmt, *args, **kwargs)
 
def debugf (fmt, *args, **kwargs)
 
def infof (fmt, *args, **kwargs)
 
def warnf (fmt, *args, **kwargs)
 
def errorf (fmt, *args, **kwargs)
 
def fatalf (fmt, *args, **kwargs)
 
def lwpID ()
 
def getLevelName (level)
 
def usePythonLogging ()
 
def doNotUsePythonLogging ()
 

Variables

int TRACE = 5000
 
int DEBUG = 10000
 
int INFO = 20000
 
int WARN = 30000
 
int ERROR = 40000
 
int FATAL = 50000
 
int CRITICAL = FATAL
 
int WARNING = WARN
 

Function Documentation

◆ configure()

def lsst.log.log.logContinued.configure ( args)

Definition at line 241 of file logContinued.py.

241 def configure(*args):
242  Log.configure(*args)
243 
244 

◆ configure_prop()

def lsst.log.log.logContinued.configure_prop (   properties)

Definition at line 245 of file logContinued.py.

245 def configure_prop(properties):
246  Log.configure_prop(properties)
247 
248 
def configure_prop(properties)

◆ configure_pylog_MDC()

def lsst.log.log.logContinued.configure_pylog_MDC ( str  level,
Optional[type]   MDC_class = MDCDict 
)
Configure log4cxx to send messages to Python logging, with MDC support.

Parameters
----------
level : `str`
    Name of the logging level for root log4cxx logger.
MDC_class : `type`, optional
    Type of dictionary which is added to `logging.LogRecord` as an ``MDC``
    attribute. Any dictionary or ``defaultdict``-like class can be used as
    a type. If `None` the `logging.LogRecord` will not be augmented.

Notes
-----
This method does two things:

- Configures log4cxx with a given logging level and a ``PyLogAppender``
  appender class which forwards all messages to Python `logging`.
- Installs a record factory for Python `logging` that adds ``MDC``
  attribute to every `logging.LogRecord` object (instance of
  ``MDC_class``). This will happen by default but can be disabled
  by setting the ``MDC_class`` parameter to `None`.

Definition at line 249 of file logContinued.py.

249 def configure_pylog_MDC(level: str, MDC_class: Optional[type] = MDCDict):
250  """Configure log4cxx to send messages to Python logging, with MDC support.
251 
252  Parameters
253  ----------
254  level : `str`
255  Name of the logging level for root log4cxx logger.
256  MDC_class : `type`, optional
257  Type of dictionary which is added to `logging.LogRecord` as an ``MDC``
258  attribute. Any dictionary or ``defaultdict``-like class can be used as
259  a type. If `None` the `logging.LogRecord` will not be augmented.
260 
261  Notes
262  -----
263  This method does two things:
264 
265  - Configures log4cxx with a given logging level and a ``PyLogAppender``
266  appender class which forwards all messages to Python `logging`.
267  - Installs a record factory for Python `logging` that adds ``MDC``
268  attribute to every `logging.LogRecord` object (instance of
269  ``MDC_class``). This will happen by default but can be disabled
270  by setting the ``MDC_class`` parameter to `None`.
271  """
272  if MDC_class is not None:
273  old_factory = logging.getLogRecordFactory()
274 
275  def record_factory(*args, **kwargs):
276  record = old_factory(*args, **kwargs)
277  record.MDC = MDC_class()
278  return record
279 
280  logging.setLogRecordFactory(record_factory)
281 
282  properties = """\
283 log4j.rootLogger = {}, PyLog
284 log4j.appender.PyLog = PyLogAppender
285 """.format(level)
286  configure_prop(properties)
287 
288 
def configure_pylog_MDC(str level, Optional[type] MDC_class=MDCDict)
def format(config, name=None, writeSourceLine=True, prefix="", verbose=False)
Definition: history.py:174

◆ critical()

def lsst.log.log.logContinued.critical (   fmt,
args 
)

Definition at line 360 of file logContinued.py.

360 def critical(fmt, *args):
361  fatal(fmt, *args)
362 
363 
def critical(fmt, *args)

◆ debug()

def lsst.log.log.logContinued.debug (   fmt,
args 
)

Definition at line 336 of file logContinued.py.

336 def debug(fmt, *args):
337  Log.getDefaultLogger()._log(DEBUG, False, fmt, *args)
338 
339 

◆ debugf()

def lsst.log.log.logContinued.debugf (   fmt,
args,
**  kwargs 
)

Definition at line 372 of file logContinued.py.

372 def debugf(fmt, *args, **kwargs):
373  Log.getDefaultLogger()._log(DEBUG, True, fmt, *args, **kwargs)
374 
375 
def debugf(fmt, *args, **kwargs)

◆ doNotUsePythonLogging()

def lsst.log.log.logContinued.doNotUsePythonLogging ( )

Definition at line 417 of file logContinued.py.

418  Log.doNotUsePythonLogging()
419 
420 

◆ error()

def lsst.log.log.logContinued.error (   fmt,
args 
)

Definition at line 352 of file logContinued.py.

352 def error(fmt, *args):
353  Log.getDefaultLogger()._log(ERROR, False, fmt, *args)
354 
355 

◆ errorf()

def lsst.log.log.logContinued.errorf (   fmt,
args,
**  kwargs 
)

Definition at line 384 of file logContinued.py.

384 def errorf(fmt, *args, **kwargs):
385  Log.getDefaultLogger()._log(ERROR, True, fmt, *args, **kwargs)
386 
387 
def errorf(fmt, *args, **kwargs)

◆ fatal()

def lsst.log.log.logContinued.fatal (   fmt,
args 
)

Definition at line 356 of file logContinued.py.

356 def fatal(fmt, *args):
357  Log.getDefaultLogger()._log(FATAL, False, fmt, *args)
358 
359 

◆ fatalf()

def lsst.log.log.logContinued.fatalf (   fmt,
args,
**  kwargs 
)

Definition at line 388 of file logContinued.py.

388 def fatalf(fmt, *args, **kwargs):
389  Log.getDefaultLogger()._log(FATAL, True, fmt, *args, **kwargs)
390 
391 
def fatalf(fmt, *args, **kwargs)

◆ getDefaultLogger()

def lsst.log.log.logContinued.getDefaultLogger ( )

Definition at line 289 of file logContinued.py.

289 def getDefaultLogger():
290  return Log.getDefaultLogger()
291 
292 

◆ getEffectiveLevel()

def lsst.log.log.logContinued.getEffectiveLevel (   loggername)

Definition at line 317 of file logContinued.py.

317 def getEffectiveLevel(loggername):
318  return Log.getLogger(loggername).getEffectiveLevel()
319 
320 
def getEffectiveLevel(loggername)

◆ getLevel()

def lsst.log.log.logContinued.getLevel (   loggername)

Definition at line 313 of file logContinued.py.

313 def getLevel(loggername):
314  return Log.getLogger(loggername).getLevel()
315 
316 
def getLevel(loggername)

◆ getLevelName()

def lsst.log.log.logContinued.getLevelName (   level)
Return the name associated with this logging level.

Returns "Level %d" if no name can be found.

Definition at line 396 of file logContinued.py.

396 def getLevelName(level):
397  """Return the name associated with this logging level.
398 
399  Returns "Level %d" if no name can be found.
400  """
401  names = ("DEBUG", "TRACE", "WARNING", "FATAL", "INFO", "ERROR")
402  for name in names:
403  test_level = getattr(Log, name)
404  if test_level == level:
405  return name
406  return f"Level {level}"
407 
408 
409 # This will cause a warning in Sphinx documentation due to confusion between
410 # UsePythonLogging and usePythonLogging.
411 # https://github.com/astropy/sphinx-automodapi/issues/73 (but note that this
412 # does not seem to be Mac-only).

◆ getLogger()

def lsst.log.log.logContinued.getLogger (   loggername)

Definition at line 293 of file logContinued.py.

293 def getLogger(loggername):
294  return Log.getLogger(loggername)
295 
296 
def getLogger(loggername)

◆ info()

def lsst.log.log.logContinued.info (   fmt,
args 
)

Definition at line 340 of file logContinued.py.

340 def info(fmt, *args):
341  Log.getDefaultLogger()._log(INFO, False, fmt, *args)
342 
343 

◆ infof()

def lsst.log.log.logContinued.infof (   fmt,
args,
**  kwargs 
)

Definition at line 376 of file logContinued.py.

376 def infof(fmt, *args, **kwargs):
377  Log.getDefaultLogger()._log(INFO, True, fmt, *args, **kwargs)
378 
379 
def infof(fmt, *args, **kwargs)

◆ isEnabledFor()

def lsst.log.log.logContinued.isEnabledFor (   loggername,
  level 
)

Definition at line 321 of file logContinued.py.

321 def isEnabledFor(loggername, level):
322  return Log.getLogger(loggername).isEnabledFor(level)
323 
324 
325 # This will cause a warning in Sphinx documentation due to confusion between
326 # Log and log. https://github.com/astropy/sphinx-automodapi/issues/73 (but
327 # note that this does not seem to be Mac-only).
def isEnabledFor(loggername, level)

◆ log()

def lsst.log.log.logContinued.log (   loggername,
  level,
  fmt,
args,
**  kwargs 
)

Definition at line 328 of file logContinued.py.

328 def log(loggername, level, fmt, *args, **kwargs):
329  Log.getLogger(loggername)._log(level, False, fmt, *args)
330 
331 
def log(loggername, level, fmt, *args, **kwargs)

◆ logf()

def lsst.log.log.logContinued.logf (   loggername,
  level,
  fmt,
args,
**  kwargs 
)

Definition at line 364 of file logContinued.py.

364 def logf(loggername, level, fmt, *args, **kwargs):
365  Log.getLogger(loggername)._log(level, True, fmt, *args, **kwargs)
366 
367 
def logf(loggername, level, fmt, *args, **kwargs)

◆ lwpID()

def lsst.log.log.logContinued.lwpID ( )

Definition at line 392 of file logContinued.py.

392 def lwpID():
393  return Log.lwpID
394 
395 

◆ MDC()

def lsst.log.log.logContinued.MDC (   key,
  value 
)

Definition at line 297 of file logContinued.py.

297 def MDC(key, value):
298  return Log.MDC(key, str(value))
299 
300 

◆ MDCRegisterInit()

def lsst.log.log.logContinued.MDCRegisterInit (   func)

Definition at line 305 of file logContinued.py.

305 def MDCRegisterInit(func):
306  Log.MDCRegisterInit(func)
307 
308 

◆ MDCRemove()

def lsst.log.log.logContinued.MDCRemove (   key)

Definition at line 301 of file logContinued.py.

301 def MDCRemove(key):
302  Log.MDCRemove(key)
303 
304 

◆ setLevel()

def lsst.log.log.logContinued.setLevel (   loggername,
  level 
)

Definition at line 309 of file logContinued.py.

309 def setLevel(loggername, level):
310  Log.getLogger(loggername).setLevel(level)
311 
312 
def setLevel(loggername, level)

◆ trace()

def lsst.log.log.logContinued.trace (   fmt,
args 
)

Definition at line 332 of file logContinued.py.

332 def trace(fmt, *args):
333  Log.getDefaultLogger()._log(TRACE, False, fmt, *args)
334 
335 

◆ tracef()

def lsst.log.log.logContinued.tracef (   fmt,
args,
**  kwargs 
)

Definition at line 368 of file logContinued.py.

368 def tracef(fmt, *args, **kwargs):
369  Log.getDefaultLogger()._log(TRACE, True, fmt, *args, **kwargs)
370 
371 
def tracef(fmt, *args, **kwargs)

◆ usePythonLogging()

def lsst.log.log.logContinued.usePythonLogging ( )

Definition at line 413 of file logContinued.py.

413 def usePythonLogging():
414  Log.usePythonLogging()
415 
416 

◆ warn()

def lsst.log.log.logContinued.warn (   fmt,
args 
)

Definition at line 344 of file logContinued.py.

344 def warn(fmt, *args):
345  Log.getDefaultLogger()._log(WARN, False, fmt, *args)
346 
347 

◆ warnf()

def lsst.log.log.logContinued.warnf (   fmt,
args,
**  kwargs 
)

Definition at line 380 of file logContinued.py.

380 def warnf(fmt, *args, **kwargs):
381  Log.getDefaultLogger()._log(WARN, True, fmt, *args, **kwargs)
382 
383 
def warnf(fmt, *args, **kwargs)

◆ warning()

def lsst.log.log.logContinued.warning (   fmt,
args 
)

Definition at line 348 of file logContinued.py.

348 def warning(fmt, *args):
349  warn(fmt, *args)
350 
351 

Variable Documentation

◆ CRITICAL

int lsst.log.log.logContinued.CRITICAL = FATAL

Definition at line 52 of file logContinued.py.

◆ DEBUG

int lsst.log.log.logContinued.DEBUG = 10000

Definition at line 45 of file logContinued.py.

◆ ERROR

int lsst.log.log.logContinued.ERROR = 40000

Definition at line 48 of file logContinued.py.

◆ FATAL

int lsst.log.log.logContinued.FATAL = 50000

Definition at line 49 of file logContinued.py.

◆ INFO

int lsst.log.log.logContinued.INFO = 20000

Definition at line 46 of file logContinued.py.

◆ TRACE

int lsst.log.log.logContinued.TRACE = 5000

Definition at line 44 of file logContinued.py.

◆ WARN

int lsst.log.log.logContinued.WARN = 30000

Definition at line 47 of file logContinued.py.

◆ WARNING

int lsst.log.log.logContinued.WARNING = WARN

Definition at line 53 of file logContinued.py.