Logging and debug levels?

Do you have questions about writing plugins or scripts in Python? Meet the coders here.
Post Reply
Plugin Developer
Posts: 881
Joined: Sun Feb 12, 2006 9:03 am

Logging and debug levels?

Post by Bartman » Wed Aug 05, 2009 7:00 pm

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.

User avatar
Site Admin
Posts: 2239
Joined: Mon Feb 06, 2006 10:28 pm

Re: Logging and debug levels?

Post by Bitmonster » Wed Aug 05, 2009 7:49 pm

@ 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.
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!

Post Reply