LsstLogAdapter¶
- class lsst.utils.logging.LsstLogAdapter(logger, extra=None)¶
- Bases: - LoggerAdapter- A 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. - critical(msg, *args, **kwargs)- Delegate a critical call to the underlying logger. - debug(msg, *args, **kwargs)- Delegate a debug call to the underlying logger. - error(msg, *args, **kwargs)- Delegate an error call to the underlying logger. - exception(msg, *args[, exc_info])- Delegate an exception call to the underlying logger. - fatal(msg, *args, **kwargs)- getChild(name)- Get the named child logger. - Get the effective level for the underlying logger. - See if the underlying logger has any handlers. - info(msg, *args, **kwargs)- Delegate an info call to the underlying logger. - isEnabledFor(level)- Is this logger enabled for level 'level'? - log(level, msg, *args, **kwargs)- Delegate a log call to the underlying logger, after adding contextual information from this adapter instance. - process(msg, kwargs)- Process the logging message and keyword arguments passed in to a logging call to insert contextual information. - 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. - warn(msg, *args, **kwargs)- warning(msg, *args, **kwargs)- Delegate a warning call to the underlying logger. - 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).
 - manager¶
 - name¶
 - Methods Documentation - addHandler(handler: Handler) None¶
- Add a handler to this logger. - Parameters:
- handlerlogging.Handler
- Handler to add. The handler is forwarded to the underlying logger. 
 
- handler
 
 - critical(msg, *args, **kwargs)¶
- Delegate a critical call to the underlying logger. 
 - debug(msg, *args, **kwargs)¶
- Delegate a debug call to the underlying logger. 
 - error(msg, *args, **kwargs)¶
- Delegate an error call to the underlying logger. 
 - exception(msg, *args, exc_info=True, **kwargs)¶
- Delegate an exception call to the underlying logger. 
 - getChild(name: str) LsstLogAdapter¶
- Get the named child logger. - Parameters:
- namestr
- Name of the child relative to this logger. 
 
- name
- Returns:
- childLsstLogAdapter
- The child logger. 
 
- child
 
 - getEffectiveLevel()¶
- Get the effective level for the underlying logger. 
 - hasHandlers()¶
- See if the underlying logger has any handlers. 
 - info(msg, *args, **kwargs)¶
- Delegate an info call to the underlying logger. 
 - isEnabledFor(level)¶
- Is this logger enabled for level ‘level’? 
 - log(level, msg, *args, **kwargs)¶
- Delegate a log call to the underlying logger, after adding contextual information from this adapter instance. 
 - process(msg, kwargs)¶
- Process the logging message and keyword arguments passed in to a logging call to insert contextual information. You can either manipulate the message itself, the keyword args or both. Return the message and kwargs modified (or not) to suit your needs. - Normally, you’ll only need to override this one method in a LoggerAdapter subclass for your specific needs. 
 - removeHandler(handler: Handler) None¶
- Remove the given handler from the underlying logger. - Parameters:
- handlerlogging.Handler
- Handler to remove. 
 
- handler
 
 - setLevel(level: int | str) None¶
- Set the level for the logger, trapping lsst.log values. - Parameters:
- levelint
- 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:
- levelint
- The new temporary log level. 
 
- level
 
 - trace(fmt: str, *args: Any, **kwargs: Any) None¶
- Issue a TRACE level log message. - Arguments are as for - logging.info.- TRACEis lower than- DEBUG.
 - verbose(fmt: str, *args: Any, **kwargs: Any) None¶
- Issue a VERBOSE level log message. - Arguments are as for - logging.info.- VERBOSEis between- DEBUGand- INFO.
 - warn(msg, *args, **kwargs)¶
 - warning(msg, *args, **kwargs)¶
- Delegate a warning call to the underlying logger.