PeriodicLogger¶
- class lsst.utils.logging.PeriodicLogger(logger: Logger | LsstLogAdapter, interval: float | None = None, level: int = 15)¶
Bases:
object
Issue log messages if a time threshold has elapsed.
This class can be used in long-running sections of code where it would be useful to issue a log message periodically to show that the algorithm is progressing.
The first time threshold is counted from object construction, so in general the first call to
log
does not log.- Parameters:
- logger
logging.Logger
orLsstLogAdapter
Logger to use when issuing a message.
- interval
float
The minimum interval in seconds between log messages. If
None
,LOGGING_INTERVAL
will be used.- level
int
, optional Log level to use when issuing messages, default is
VERBOSE
.
- logger
Attributes Summary
Default interval between log messages in seconds.
Methods Summary
log
(msg, *args)Issue a log message if the interval has elapsed.
Attributes Documentation
- LOGGING_INTERVAL = 600.0¶
Default interval between log messages in seconds.
Methods Documentation
- log(msg: str, *args: Any) bool ¶
Issue a log message if the interval has elapsed.
The interval is measured from the previous call to
log
, or from the creation of this object.- Parameters:
- msg
str
Message to issue if the time has been exceeded.
- *argsAny
Arguments to be merged into the message string, as described under
logging.Logger.debug
.
- msg
- Returns: