Skip to content

Commit

Permalink
document using the logger
Browse files Browse the repository at this point in the history
  • Loading branch information
mdekstrand committed Dec 31, 2024
1 parent 7607abf commit 5fb7e43
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docs/guide/logging.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ LensKit provides support code for logging and progress reporting. This code
lives in the :py:mod:`lenskit.logging` package and provides several
capabilities:

- Logger acquisition functions with useful defaults.
- Backend-independent progress reporting, with colorful progress bars (via
Rich_) on terminals.
- Easy logging configuration for recommender scripts, supporting log files and
Expand Down Expand Up @@ -74,6 +75,15 @@ are run by other tools like DVC.
level; this allows you to send ``DEBUG`` messages to the file while only
``INFO`` messages go to the console.

Emitting Log Messages
~~~~~~~~~~~~~~~~~~~~~

When writing LensKit code that needs to emit log messages, use LensKit's
:func:`~lenskit.logging.get_logger` function. This wraps Structopt's
``get_logger`` in a proxy that has more useful LensKit defaults (only emitting
warnings and errors when logging has not been configured). The resulting logger
can be used like any other Structlog or standard library logger.

Progress Reporting
~~~~~~~~~~~~~~~~~~

Expand Down

0 comments on commit 5fb7e43

Please sign in to comment.