LsstLogAdapter#
- class lsst.utils.logging.LsstLogAdapter(logger, extra=None, merge_extra=False)#
Bases:
LoggerAdapterA special logging adapter to provide log features for LSST code.
Expected to be instantiated initially by a call to
getLogger().This class provides enhancements over
logging.Loggerthat include:Methods for issuing trace and verbose level log messages.
Provision of a context manager to temporarily change the log level.
Attachment of logging level constants to the class to make it easier for a Task writer to access a specific log level without having to know the underlying logger class.
Attributes Summary
Log handlers associated with this logger.
Return current level of this logger (
int).Methods Summary
addHandler(handler)Add a handler to this logger.
fatal(msg, *args, **kwargs)getChild(name)Get the named child logger.
removeHandler(handler)Remove the given handler from the underlying logger.
setLevel(level)Set the level for the logger, trapping lsst.log values.
temporary_log_level(level)Temporarily set the level of this logger.
trace(fmt, *args, **kwargs)Issue a TRACE level log message.
verbose(fmt, *args, **kwargs)Issue a VERBOSE level log message.
Attributes Documentation
- CRITICAL = 50#
- DEBUG = 10#
- ERROR = 40#
- FATAL = 50#
- INFO = 20#
- TRACE = 5#
- VERBOSE = 15#
- WARN = 30#
- WARNING = 30#
- handlers#
Log handlers associated with this logger.
- level#
Return current level of this logger (
int).
Methods Documentation
- addHandler(handler: Handler) None#
Add a handler to this logger.
Parameters#
- handler
logging.Handler Handler to add. The handler is forwarded to the underlying logger.
- handler
- fatal(msg: str, *args: Any, **kwargs: Any) None#
- getChild(name: str) LsstLogAdapter#
Get the named child logger.
Parameters#
- name
str Name of the child relative to this logger.
Returns#
- child
LsstLogAdapter The child logger.
- name
- removeHandler(handler: Handler) None#
Remove the given handler from the underlying logger.
Parameters#
- handler
logging.Handler Handler to remove.
- handler
- setLevel(level: int | str) None#
Set the level for the logger, trapping lsst.log values.
Parameters#
- level
int The level to use. If the level looks too big to be a Python logging level it is assumed to be a lsst.log level.
- level
- temporary_log_level(level: int | str) Generator#
Temporarily set the level of this logger.
Parameters#
- level
int The new temporary log level.
- level