LSST Applications g0b6bd0c080+a72a5dd7e6,g1182afd7b4+2a019aa3bb,g17e5ecfddb+2b8207f7de,g1d67935e3f+06cf436103,g38293774b4+ac198e9f13,g396055baef+6a2097e274,g3b44f30a73+6611e0205b,g480783c3b1+98f8679e14,g48ccf36440+89c08d0516,g4b93dc025c+98f8679e14,g5c4744a4d9+a302e8c7f0,g613e996a0d+e1c447f2e0,g6c8d09e9e7+25247a063c,g7271f0639c+98f8679e14,g7a9cd813b8+124095ede6,g9d27549199+a302e8c7f0,ga1cf026fa3+ac198e9f13,ga32aa97882+7403ac30ac,ga786bb30fb+7a139211af,gaa63f70f4e+9994eb9896,gabf319e997+ade567573c,gba47b54d5d+94dc90c3ea,gbec6a3398f+06cf436103,gc6308e37c7+07dd123edb,gc655b1545f+ade567573c,gcc9029db3c+ab229f5caf,gd01420fc67+06cf436103,gd877ba84e5+06cf436103,gdb4cecd868+6f279b5b48,ge2d134c3d5+cc4dbb2e3f,ge448b5faa6+86d1ceac1d,gecc7e12556+98f8679e14,gf3ee170dca+25247a063c,gf4ac96e456+ade567573c,gf9f5ea5b4d+ac198e9f13,gff490e6085+8c2580be5c,w.2022.27
LSST Data Management Base Package
Classes | Functions | Variables
lsst.log.log.logContinued Namespace Reference

Classes

class  LevelTranslator
 
class  Log
 
class  LogHandler
 
class  MDCDict
 
class  UsePythonLogging
 

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.

241def 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.

245def 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.

249def 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 = """\
283log4j.rootLogger = {}, PyLog
284log4j.appender.PyLog = PyLogAppender
285""".format(level)
286 configure_prop(properties)
287
288
table::Key< int > to
bool all(CoordinateExpr< N > const &expr) noexcept
Return true if all elements are true.
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.

360def 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.

336def 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.

372def 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.

352def 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.

384def 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.

356def 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.

388def 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.

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

◆ getEffectiveLevel()

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

Definition at line 317 of file logContinued.py.

317def 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.

313def 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.

396def 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.

293def 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.

340def 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.

376def 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.

321def 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.

328def 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.

364def 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.

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

◆ MDC()

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

Definition at line 297 of file logContinued.py.

297def 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.

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

◆ MDCRemove()

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

Definition at line 301 of file logContinued.py.

301def 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.

309def 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.

332def 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.

368def 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.

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

◆ warn()

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

Definition at line 344 of file logContinued.py.

344def 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.

380def 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.

348def 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.