logInfo¶
-
lsst.utils.timer.
logInfo
(obj: Any, prefix: str, logLevel: int = 10, metadata: Optional[MutableMapping[KT, VT]] = None, logger: Optional[logging.Logger] = None, stacklevel: Optional[int] = None) → None¶ Log timer information to
obj.metadata
andobj.log
.Parameters: - obj :
object
An object with both or one these two attributes:
metadata
adict
-like container for storing metadata. Can use theadd(name, value)
method if found, else will append entries to a list.log
an instance oflogging.Logger
or subclass.
If
None
, at least one ofmetadata
orlogger
should be passed or this function will do nothing.- prefix :
str
Name prefix, the resulting entries are
CpuTime
, etc.. For exampletimeMethod
usesprefix = Start
when the method begins andprefix = End
when the method ends.- logLevel : optional
Log level (a
logging
level constant, such aslogging.DEBUG
).- metadata :
collections.abc.MutableMapping
, optional Metadata object to write entries to, overriding
obj.metadata
.- logger :
logging.Logger
Log object to write entries to, overriding
obj.log
.- stacklevel :
int
, optional The stack level to pass to the logger to adjust which stack frame is used to report the file information. If
None
the stack level is computed such that it is reported as the first package outside of the utils package. If a value is given here it is adjusted by 1 to account for this caller.
Notes
Logged items include:
Utc
: UTC date in ISO format (only in metadata since log entries have timestamps).CpuTime
: System + User CPU time (seconds). This should only be used- in differential measurements; the time reference point is undefined.
MaxRss
: maximum resident set size.
All logged resource information is only for the current process; child processes are excluded.
- obj :