lenskit.logging#
Logging, progress, and resource records.
Submodules#
Multiprocess logging support for Ray integration. Most code doesn't need to |
|
Abstraction for recording tasks. |
Attributes#
Classes#
Configuration for LensKit logging. |
|
Single measurement of resources. Two measurements can be subtracted to |
|
Timer class for recording elapsed wall time in operations. |
|
Logger-like thing that is only for TRACE-level events. |
Functions#
|
Simple one-function logging configuration for simple command lines. |
|
Simple one-function logging configuration for notebooks and similar. |
Get a console attached to |
|
|
Short, human-friendly representation of a duration. |
|
Get a logger. This works like |
|
Get a tracer for efficient low-level tracing of computations. |
|
Emit a trace-level message, if LensKit tracing is enabled. Trace-level |
Package Contents#
- lenskit.logging.basic_logging(level=logging.INFO)#
Simple one-function logging configuration for simple command lines.
- Stability:
- Caller (see Stability Levels).
- Parameters:
level (int)
- lenskit.logging.notebook_logging(level=logging.INFO)#
Simple one-function logging configuration for notebooks and similar.
- Stability:
- Caller (see Stability Levels).
- Parameters:
level (int)
- lenskit.logging.console#
- lenskit.logging.stdout_console()#
Get a console attached to
stdout.
- lenskit.logging.friendly_duration(elapsed)#
Short, human-friendly representation of a duration.
- Parameters:
elapsed (float | datetime.timedelta)
- lenskit.logging.get_logger(name, *, remove_private=True, **init_als)#
Get a logger. This works like
structlog.stdlib.get_logger(), except the returned proxy logger is quiet (only WARN and higher messages) if structlog has not been configured. LensKit code should use this instead of obtaining loggers from Structlog directly.It also suppresses private module name components of the logger name, so e.g.
lenskit.pipeline._implbecomes ``lenskit.pipeline`.- Params:
- name:
The logger name.
- remove_private:
Set to
Falseto keep private module components of the logger name instead of removing them.- init_vals:
Initial values to bind into the logger when crated.
- Returns:
A lazy proxy logger. The returned logger is type-compatible with
structlib.stdlib.BoundLogger, but is actually an instance of an internal proxy that provies more sensible defaults and handles LensKit’s TRACE-level logging support.- Parameters:
- Return type:
- lenskit.logging.get_tracer(logger, **initial_values)#
Get a tracer for efficient low-level tracing of computations.
- Stability:
Experimental
- Parameters:
logger (str | structlog.stdlib.BoundLogger)
initial_values (Any)
- lenskit.logging.trace(logger, *args, **kwargs)#
Emit a trace-level message, if LensKit tracing is enabled. Trace-level messages are more fine-grained than debug-level messages, and you usually don’t want them.
This function does not work on the lazy proxies returned by
get_logger()and similar — it only works on bound loggers.- Stability:
- Caller (see Stability Levels).
- Parameters:
logger (structlog.stdlib.BoundLogger)
args (Any)
kwargs (Any)
Exported Aliases#
- class lenskit.logging.Progress#
Re-exported alias for
lenskit.logging.progress.Progress.
- lenskit.logging.item_progress()#
Re-exported alias for
lenskit.logging.progress.item_progress().
- lenskit.logging.set_progress_impl()#
Re-exported alias for
lenskit.logging.progress.set_progress_impl().
- class lenskit.logging.Task#
Re-exported alias for
lenskit.logging.tasks.Task.