Minor text changes to log message limitation

This commit is contained in:
Justin Mayer 2014-04-14 16:18:07 -04:00
commit 7e06912bca
5 changed files with 21 additions and 21 deletions

View file

@ -157,24 +157,24 @@ For logging messages that are not repeated, use the usual Python way:
logger = logging.getLogger(__name__)
# when needed
logger.warning('A warning that could occur only once")
logger.warning("A warning that would usually occur only once")
However, if you want to log messages that may occur several times, instead of
a string, gives a tuple to the logging method, with two arguments:
a string, give a tuple to the logging method, with two arguments:
1. The message to log for this very execution
2. A generic message that will appear if the previous one would occur to many
1. The message to log for the initial execution
2. A generic message that will appear if the previous one would occur too many
times.
For example, if you want to log missing resources, use the following code:
for ressource in ressources:
if ressource.is_missing:
for resource in resources:
if resource.is_missing:
logger.warning((
'The resource {r} is missing'.format(r=ressource.name),
'The resource {r} is missing'.format(r=resource.name),
'Other resources were missing'))
The logs will be displayed as follows:
The log messages will be displayed as follows:
WARNING: The resource prettiest_cat.jpg is missing
WARNING: The resource best_cat_ever.jpg is missing

View file

@ -88,7 +88,7 @@ Setting name (default value)
here or a single string representing one locale.
When providing a list, all the locales will be tried
until one works.
`LOG_FILTER` (``[]``) A list of tuples containing the logging level (up to warning)
`LOG_FILTER` (``[]``) A list of tuples containing the logging level (up to ``warning``)
and the message to be ignored.
For example: ``[(logging.WARN, 'TAG_SAVE_AS is set to False')]``
`READERS` (``{}``) A dictionary of file extensions / Reader classes for Pelican to
@ -701,15 +701,15 @@ adding the following to your configuration::
Logging
=======
Sometimes, useless lines of log appears while the generation occurs. Finding
**the** meaningful error message in the middle of tons of annoying log outputs
can be quite tricky. To be able to filter out all useless log messages, Pelican
Sometimes, a long list of warnings may appear during site generation. Finding
the **meaningful** error message in the middle of tons of annoying log output
can be quite tricky. In order to filter out redundant log messages, Pelican
comes with the ``LOG_FILTER`` setting.
``LOG_FILTER`` should be a list of tuples ``(level, msg)``, each of them being
composed of the logging level (up to warning) and the message to be ignored.
Simply populate the list with the logs you want to hide and they will be
filtered out.
composed of the logging level (up to ``warning``) and the message to be ignored.
Simply populate the list with the log messages you want to hide, and they will
be filtered out.
For example: ``[(logging.WARN, 'TAG_SAVE_AS is set to False')]``