Improved logging documentation.

This commit is contained in:
Bastian Kleineidam 2011-03-09 12:08:03 +01:00
parent 31d4f04fd2
commit 2c53507097
3 changed files with 11 additions and 27 deletions

View file

@ -124,7 +124,7 @@ class Logger (object):
Base class for logging of checked urls. It defines the public API
(see below) and offers basic functionality for all loggers.
Each logger has to offer the following functions:
Each logger offers the following functions:
* start_output()
Initialize and start log output. Most loggers print a comment
@ -136,6 +136,15 @@ class Logger (object):
Log a checked URL. The url_data object is a transport form of
the UrlData class. The do_print flag indicates if this URL
should be logged or just used to update internal statistics.
Each subclassed logger must implement the following functions:
* start_output()
Also call the base class implementation of this.
* end_output()
See above.
* log_url(url_data)
Log a checked URL. Called by log_filter_url if do_print is True.
"""
def __init__ (self, **args):

View file

@ -26,31 +26,6 @@ class TextLogger (Logger):
"""
A text logger, colorizing the output if possible.
Every Logger has to implement the following functions:
C{def start_output (self)}
Called once to initialize the Logger. Why do we not use __init__(self)?
Because we initialize the start time in start_output and __init__ gets
not called at the time the checking starts but when the logger object is
created.
Another reason is that we might want to create several loggers
as a default and then switch to another configured output. So we
must not print anything out at __init__ time.
C{def log_filter_url (self, url_data, do_print)}
Called every time an url finished checking. All data we checked is in
the UrlData object url_data.
C{def end_output (self)}
Called at the end of checking to close filehandles and such.
Passing parameters to the constructor:
C{def __init__ (self, **args)}
The args dictionary is filled in Config.py. There you can specify
default parameters. Adjust these parameters in the configuration
files in the appropriate logger section.
Informal text output format spec:
Output consists of a set of URL logs separated by one or more
blank lines.

View file

@ -45,7 +45,7 @@ def xmlquoteattr (s):
class XMLLogger (Logger):
"""XML output; easy to parse with any XML tool."""
"""Base class for XML output; easy to parse with any XML tool."""
def __init__ (self, **args):
"""