lenskit.logging =============== .. py:module:: lenskit.logging .. autoapi-nested-parse:: Logging, progress, and resource records. Submodules ---------- .. autoapisummary:: lenskit.logging.multiprocess lenskit.logging.progress lenskit.logging.tasks .. toctree:: :hidden: :maxdepth: 1 /api/lenskit/logging/multiprocess/index /api/lenskit/logging/progress/index /api/lenskit/logging/tasks/index Attributes ---------- .. autoapisummary:: lenskit.logging.console Classes ------- .. toctree:: :hidden: /api/lenskit/logging/LoggingConfig /api/lenskit/logging/ResourceMeasurement /api/lenskit/logging/Stopwatch /api/lenskit/logging/Tracer .. autoapisummary:: lenskit.logging.LoggingConfig lenskit.logging.ResourceMeasurement lenskit.logging.Stopwatch lenskit.logging.Tracer Functions --------- .. autoapisummary:: lenskit.logging.basic_logging lenskit.logging.notebook_logging lenskit.logging.stdout_console lenskit.logging.friendly_duration lenskit.logging.get_logger lenskit.logging.get_tracer lenskit.logging.trace Package Contents ---------------- .. py:function:: basic_logging(level = logging.INFO) Simple one-function logging configuration for simple command lines. :Stability: Caller .. py:function:: notebook_logging(level = logging.INFO) Simple one-function logging configuration for notebooks and similar. :Stability: Caller .. py:data:: console .. py:function:: stdout_console() Get a console attached to ``stdout``. .. py:function:: friendly_duration(elapsed) Short, human-friendly representation of a duration. .. py:function:: get_logger(name, *, remove_private = True, **init_als) Get a logger. This works like :func:`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._impl`` becomes ``lenskit.pipeline`. Params: name: The logger name. remove_private: Set to ``False`` to 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 :class:`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. .. py:function:: get_tracer(logger, **initial_values) Get a tracer for efficient low-level tracing of computations. :Stability: Experimental .. py:function:: 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 :func:`get_logger` and similar — it only works on bound loggers. :Stability: Caller Exported Aliases ---------------- .. py:class:: lenskit.logging.Progress Re-exported alias for :py:class:`lenskit.logging.progress.Progress`. .. py:function:: lenskit.logging.item_progress Re-exported alias for :py:func:`lenskit.logging.progress.item_progress`. .. py:function:: lenskit.logging.set_progress_impl Re-exported alias for :py:func:`lenskit.logging.progress.set_progress_impl`. .. py:class:: lenskit.logging.Task Re-exported alias for :py:class:`lenskit.logging.tasks.Task`.