getLogger¶
- lsst.utils.logging.getLogger(name: str | None = None, logger: Logger | None = None) LsstLogAdapter ¶
Get a logger compatible with LSST usage.
- Parameters:
- name
str
, optional Name of the logger. Root logger if
None
.- logger
logging.Logger
orLsstLogAdapter
If given the logger is converted to the relevant logger class. If
name
is given the logger is assumed to be a child of the supplied logger.
- name
- Returns:
- logger
LsstLogAdapter
The relevant logger.
- logger
Notes
A
logging.LoggerAdapter
is used since it is easier to provide a more uniform interface than when usinglogging.setLoggerClass
. An adapter can be wrapped around the root logger and thesetLoggerClass
will return the logger first given that name even if the name was used before theTask
was created.