2022-02-14 09:11:30 +03:00
|
|
|
"""Logging setup.
|
2012-01-30 20:54:51 +04:00
|
|
|
|
2022-02-14 09:11:30 +03:00
|
|
|
The rest of the code gets the logger through this module rather than
|
|
|
|
``logging.getLogger`` to make sure that it is configured.
|
2012-05-24 19:44:38 +04:00
|
|
|
|
2022-02-14 09:11:30 +03:00
|
|
|
Logging levels are used for specific purposes:
|
2017-07-25 14:59:56 +03:00
|
|
|
|
2022-02-14 09:11:30 +03:00
|
|
|
- errors are used in ``LOGGER`` for unreachable or unusable external resources,
|
|
|
|
including unreachable stylesheets, unreachables images and unreadable images;
|
|
|
|
- warnings are used in ``LOGGER`` for unknown or bad HTML/CSS syntaxes,
|
|
|
|
unreachable local fonts and various non-fatal problems;
|
|
|
|
- infos are used in ``PROCESS_LOGGER`` to advertise rendering steps.
|
2017-07-25 14:59:56 +03:00
|
|
|
|
2012-01-30 20:54:51 +04:00
|
|
|
"""
|
|
|
|
|
|
|
|
import logging
|
|
|
|
|
2012-02-22 20:12:40 +04:00
|
|
|
LOGGER = logging.getLogger('weasyprint')
|
2020-01-02 02:43:06 +03:00
|
|
|
if not LOGGER.handlers: # pragma: no cover
|
2019-02-15 14:23:51 +03:00
|
|
|
LOGGER.setLevel(logging.WARNING)
|
|
|
|
LOGGER.addHandler(logging.NullHandler())
|
2019-01-04 01:02:44 +03:00
|
|
|
|
|
|
|
PROGRESS_LOGGER = logging.getLogger('weasyprint.progress')
|