Update docs: mention multi-level logging

If you think what I wrote suck, it's because it does.
This commit is contained in:
Bruno Cauet 2015-02-10 17:26:56 +01:00
parent f1e13cf886
commit a014750e2d
3 changed files with 24 additions and 12 deletions

View file

@ -6,6 +6,9 @@ Changelog
Features:
* Verbosity is now an integer in the configuration since multiple levels are
supported (like e.g. apt-get). On the CLI one can stack verbose flags (i.e.
`-vv`). :bug:`1244`
* The summary shown to compare duplicate albums during import now displays
the old and new filesizes. :bug:`1291`
* The colors used are now configurable via the new config option ``colors``,
@ -106,7 +109,9 @@ For developers:
* The logging system in beets has been overhauled. Plugins now each have their
own logger, which helps by automatically adjusting the verbosity level in
import mode and by prefixing the plugin's name. Also, logging calls can (and
import mode and by prefixing the plugin's name. Logging levels are
dynamically set when a plugin is called, depending on how it is called
(import stage, event or direct command). Finally, logging calls can (and
should!) use modern ``{}``-style string formatting lazily. See
:ref:`plugin-logging` in the plugin API docs.
* A new ``import_task_created`` event lets you manipulate import tasks

View file

@ -480,14 +480,21 @@ str.format-style string formatting. So you can write logging calls like this::
.. _PEP 3101: https://www.python.org/dev/peps/pep-3101/
.. _standard Python logging module: https://docs.python.org/2/library/logging.html
The per-plugin loggers have two convenient features:
When beets is in verbose mode, plugin messages are prefixed with the plugin
name to make them easier to see.
What messages will be logged depends on the logging level and the action
performed:
* On import stages and event, the default is ``WARNING`` messages.
* On direct actions, the default is ``INFO`` and ``WARNING`` message.
The verbosity can be increased with ``--verbose`` flags: each flags lowers the
level by a notch.
This addresses a common pattern where plugins need to use the same code for a
command and an import stage, but the command needs to print more messages than
the import stage. (For example, you'll want to log "found lyrics for this song"
when you're run explicitly as a command, but you don't want to noisily
interrupt the importer interface when running automatically.)
* When beets is in verbose mode, messages are prefixed with the plugin name to
make them easier to see.
* Messages at the ``INFO`` logging level are hidden when the plugin is running
in an importer stage (see above). This addresses a common pattern where
plugins need to use the same code for a command and an import stage, but the
command needs to print more messages than the import stage. (For example,
you'll want to log "found lyrics for this song" when you're run explicitly
as a command, but you don't want to noisily interrupt the importer interface
when running automatically.)

View file

@ -369,7 +369,7 @@ import ...``.
* ``-l LIBPATH``: specify the library database file to use.
* ``-d DIRECTORY``: specify the library root directory.
* ``-v``: verbose mode; prints out a deluge of debugging information. Please use
this flag when reporting bugs.
this flag when reporting bugs. It can be stacked twice.
* ``-c FILE``: read a specified YAML :doc:`configuration file <config>`.
Beets also uses the ``BEETSDIR`` environment variable to look for