Page 1 of 1

Logging and debug levels?

Posted: Wed Aug 05, 2009 7:00 pm
by Bartman
I want to add some functionality to get more infos if users encounter some problems.
What is the EG way to do this?

After a quick look at the code I found the eg.LogIt function but what is the '@' before the call.
What is the difference between the debug and the debug2 command line parameter?

I found the easy code fragement

Code: Select all

if eg.debugLevel:
    print "xyz"
On other occasions I found the PrintDebugNotice function which seems to be defined depending on the debugLevel.
I guess there are no different debug levels (INFO, DEBUG, WARN, ERROR, FATAL) as I know them from log4j?

little confused.

Re: Logging and debug levels?

Posted: Wed Aug 05, 2009 7:49 pm
by Bitmonster
@ is a Python function decorator: http://www.python.org/dev/peps/pep-0318/
Generally use @LogIt, @LogItWithReturn and the function PrintDebugNotice if you think the info should stay there for future debugging. There are no log-levels.

-debug2 is only used if the code is run inside the eclipse/pydev IDE, since it uses some special hooks for stdout/stderr handling. If you develop on another IDE use -debug.