[Zope] print

Paul Winkler pw_lists at slinkp.com
Fri Dec 5 17:35:40 EST 2003


On Fri, Dec 05, 2003 at 11:03:55PM +0100, Andre Meyer wrote:
> Hi All
> 
> In a file-system-based product, when I print some output in a Python
> method, where does the output go? There is no command line output as far
> as I can see.
> It would be nice to at least print some results when things go wrong.
> Any ideas?

Logging is good for that.

from zLOG import LOG, INFO, ERROR

class MyProduct(...)
    def doSomethingInteresting(self, foo):
        try:
            foo.bar()
            zLOG.LOG('MyProduct', INFO, 'everything is ok')
        except:
            zLOG.LOG('MyProduct', ERROR, 'some error occurred')
            raise

Output will go to stderr if you are running zope in debug mode,
or to the event log (configured with $EVENT_LOG_FILE in zope <= 2.6,
or with the config file in zope >= 2.7).

-- 

Paul Winkler
http://www.slinkp.com
Look! Up in the sky! It's BIO LUGGAGE MAFIOSO!
(random hero from isometric.spaceninja.com)



More information about the Zope mailing list