|
From: Waylan L. <wa...@gm...> - 2008-03-05 19:15:56
|
On Wed, Mar 5, 2008 at 12:08 PM, Malthe Borch <mb...@gm...> wrote:
> Hey Waylan, ––
>
> In the 1.7-release of markdown there are some DEBUG statements left in
> the code; is that on purpose?
>
Malthe,
I'm assuming you are referring to `message` statements set to level
DEBUG, like so:
message(DEBUG, "a debug message")
If so, yes, that was intentional. If you notice, starting about line
36 we are using python's logging module and by default the logger is
set to level CRITICAL. That being the case any lower level (like
DEBUG) is ignored. However, if one wanted to do some debugging, a
simple change of the logger level would make that easy. This is
actually the intended purpose of the logging module. Much better than
adding (and latter remembering to find and remove) print statements.
If you'd like more information on the logging module, see the
[docs][1] or [PEP 282][2].
[1]: http://docs.python.org/lib/module-logging.html
[2]: http://www.python.org/dev/peps/pep-0282/
As the PEP says (under the "Configuration" section):
> The main benefit of a logging system like this is that one can
> control how much and what logging output one gets from an
> application without changing that application's source code.
> Therefore, although configuration can be performed through the
> logging API, it must also be possible to change the logging
> configuration without changing an application at all.
If your wondering why this is necessary for a command line script like
markdown, remember that many (perhaps most) are using markdown.py
behind a web server which would require the ability to reconfigure
logging. Such a user could conceivably redirect such messages to their
servers error log for review when problems are encountered. In fact,
in most web server configurations this is the only way to debug a
problem.
I hope that answers your question. However, if you actually found some
print statements or such that I missed, please let me know where and
I'll remove them.
Either way, thanks for your feedback. It's always appreciated. In
fact, this reminds me that I should probably document how to configure
the logger for a few basic use cases.
--
----
Waylan Limberg
wa...@gm...
|