time_this

lsst.daf.butler.core.utils.time_this(log: Optional[logging.Logger] = None, msg: Optional[str] = None, level: int = 10, prefix: Optional[str] = 'timer', args: Iterable[Any] = ()) → Iterator[None]

Time the enclosed block and issue a log message.

Parameters:
log : logging.Logger, optional

Logger to use to report the timer message. The root logger will be used if none is given.

msg : str, optional

Context to include in log message.

level : int, optional

Python logging level to use to issue the log message. If the code block raises an exception the log message will automatically switch to level ERROR.

prefix : str, optional

Prefix to use to prepend to the supplied logger to create a new logger to use instead. No prefix is used if the value is set to None. Defaults to “timer”.

args : iterable of any

Additional parameters passed to the log command that should be written to msg.