@@ -449,29 +449,31 @@ Then they will receive messages like::
449
449
Which logging level to use?
450
450
~~~~~~~~~~~~~~~~~~~~~~~~~~~
451
451
452
- There are five levels at which you can emit messages.
453
- `logging.critical ` and `logging.error `
454
- are really only there for errors that will end the use of the library but
455
- not kill the interpreter. `logging.warning ` overlaps with the
456
- ``warnings `` library. The
457
- `logging tutorial <https://docs.python.org/3/howto/logging.html#logging-basic-tutorial >`_
458
- suggests that the difference
459
- between `logging.warning ` and `warnings.warn ` is that
460
- `warnings.warn ` be used for things the user must change to stop
461
- the warning, whereas `logging.warning ` can be more persistent.
452
+ There are five levels at which you can emit messages. `logging.critical ` and
453
+ `logging.error ` are really only there for errors that will end the use of the
454
+ library but not kill the interpreter. `logging.warning ` overlaps with the
455
+ `warnings ` library. The `logging tutorial `_ suggests that the difference
456
+ between `logging.warning ` and `warnings.warn ` is that `warnings.warn ` should
457
+ be used for things the user must change to stop the warning (typically in the
458
+ source), whereas `logging.warning ` can be more persistent. Moreover, note
459
+ that `warnings.warn ` will by default only emit a given warning *once *, whereas
460
+ `logging.warning ` will display the message every time it is called.
462
461
463
462
By default, `logging ` displays all log messages at levels higher than
464
463
`logging.WARNING ` to `sys.stderr `.
465
464
466
465
Calls to `logging.info ` are not displayed by default. They are for
467
466
information that the user may want to know if the program behaves oddly.
468
467
For instance, if an object isn't drawn because its position is ``NaN ``,
469
- that can usually be ignored, but a mystified user could set
468
+ that can usually be ignored, but a mystified user could call
470
469
``logging.basicConfig(level=logging.INFO) `` and get an error message that
471
470
says why.
472
471
473
- `logging.debug ` is the least likely to be displayed, and hence can
474
- be the most verbose.
472
+ `logging.debug ` is the least likely to be displayed, and hence can be the most
473
+ verbose. "Expected" code paths (e.g., reporting normal intermediat steps of
474
+ layouting or rendering) should only log at this level.
475
+
476
+ .. _logging tutorial : https://docs.python.org/3/howto/logging.html#logging-basic-tutorial
475
477
476
478
.. _custom_backend :
477
479
0 commit comments