Debugging in Py
jeremiah.dodds at gmail.com
Thu Mar 26 13:09:00 CET 2009
On Wed, Mar 25, 2009 at 9:25 PM, *nixtechno <epctechno at gmail.com> wrote:
> Big thanks tkc, and I was wondering what your thoughts are on logging
> module: http://docs.python.org/library/logging.html
> "Instead of using many print statements for debugging, use
> logger.debug: Unlike the print statements, which you will have to
> delete or comment out later, the logger.debug statements can remain
> intact in the source code and remain dormant until you need them
> again. At that time, the only change that needs to happen is to modify
> the severity level of the logger and/or handler to debug."
> Where it makes sense as they state using this rather than printing,
> due to the fact that you don't have to strip it all out when it's time
> to release your work... I seen some writing on pdb, but I guess it's
> time to study up on it. I appreciate the help.
I really like the logging module. From the perspective of what you're
writing while you're working on part of an application, it tends to not be
that different that dropping print statements in, but there's a wealth of
flexibility and customizability available to you on the high level.
For instance, I use it at work for one of our applications, and it emails me
whenever certain types of events occur that I need to know about. It might
be overkill for small projects, but it's definately worth getting to know.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list