LSST Applications  21.0.0-147-g0e635eb1+1acddb5be5,22.0.0+052faf71bd,22.0.0+1ea9a8b2b2,22.0.0+6312710a6c,22.0.0+729191ecac,22.0.0+7589c3a021,22.0.0+9f079a9461,22.0.1-1-g7d6de66+b8044ec9de,22.0.1-1-g87000a6+536b1ee016,22.0.1-1-g8e32f31+6312710a6c,22.0.1-10-gd060f87+016f7cdc03,22.0.1-12-g9c3108e+df145f6f68,22.0.1-16-g314fa6d+c825727ab8,22.0.1-19-g93a5c75+d23f2fb6d8,22.0.1-19-gb93eaa13+aab3ef7709,22.0.1-2-g8ef0a89+b8044ec9de,22.0.1-2-g92698f7+9f079a9461,22.0.1-2-ga9b0f51+052faf71bd,22.0.1-2-gac51dbf+052faf71bd,22.0.1-2-gb66926d+6312710a6c,22.0.1-2-gcb770ba+09e3807989,22.0.1-20-g32debb5+b8044ec9de,22.0.1-23-gc2439a9a+fb0756638e,22.0.1-3-g496fd5d+09117f784f,22.0.1-3-g59f966b+1e6ba2c031,22.0.1-3-g849a1b8+f8b568069f,22.0.1-3-gaaec9c0+c5c846a8b1,22.0.1-32-g5ddfab5d3+60ce4897b0,22.0.1-4-g037fbe1+64e601228d,22.0.1-4-g8623105+b8044ec9de,22.0.1-5-g096abc9+d18c45d440,22.0.1-5-g15c806e+57f5c03693,22.0.1-7-gba73697+57f5c03693,master-g6e05de7fdc+c1283a92b8,master-g72cdda8301+729191ecac,w.2021.39
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.