Jeremiah Dodds wrote:


On Wed, Mar 25, 2009 at 9:25 PM, *nixtechno <epctec...@gmail.com <mailto:epctec...@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.
    --
    http://mail.python.org/mailman/listinfo/python-list


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.

You can also redirect the logger output to various places like wx text controls if you use the model that wxPython itself uses to redirect print statements to its debug console window. There's no end to how you can use logger output if you work things this way since logger refines its output based on a
hierarchical namespace that you can modify from any point in runtime.

E.G. direct errors and other text output from .THIS namespace logger to .THIS text window or scrolling
list or  logger file (or all of the above).


Lawson

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to