Home | Trees | Indices | Help |
---|
|
|
|||
NoDebug | |||
Debug |
|
|||
_version_ =
Generic debug class |
|||
colors_enabled = True
|
|||
color_none =
|
|||
color_black =
|
|||
color_red =
|
|||
color_green =
|
|||
color_brown =
|
|||
color_blue =
|
|||
color_magenta =
|
|||
color_cyan =
|
|||
color_light_gray =
|
|||
color_dark_gray =
|
|||
color_bright_red =
|
|||
color_bright_green =
|
|||
color_yellow =
|
|||
color_bright_blue =
|
|||
color_purple =
|
|||
color_bright_cyan =
|
|||
color_white =
Define your flags in yor modules like this:... |
|||
LINE_FEED =
|
|||
DBG_ALWAYS =
|
|||
DEBUGGING_IS_ON = 1
|
|
_version_Generic debug class Other modules can always define extra debug flags for local usage, as long as they make sure they append them to debug_flags Also its always a good thing to prefix local flags with something, to reduce risk of coliding flags. Nothing breaks if two flags would be identical, but it might activate unintended debugging. flags can be numeric, but that makes analysing harder, on creation its not obvious what is activated, and when flag_show is given, output isnt really meaningfull. This Debug class can either be initialized and used on app level, or used independantly by the individual classes. For samples of usage, see samples subdir in distro source, and selftest in this code
|
color_whiteDefine your flags in yor modules like this: from debug import * DBG_INIT = 'init' ; debug_flags.append( DBG_INIT ) DBG_CONNECTION = 'connection' ; debug_flags.append( DBG_CONNECTION ) The reason for having a double statement wis so we can validate params and catch all undefined debug flags This gives us control over all used flags, and makes it easier to allow global debugging in your code, just do something like foo = Debug( debug_flags ) group flags, that is a flag in it self containing multiple flags should be defined without the debug_flags.append() sequence, since the parts are already in the list, also they must of course be defined after the flags they depend on ;) example: DBG_MULTI = [ DBG_INIT, DBG_CONNECTION ] NoDebug ------- To speed code up, typically for product releases or such use this class instead if you globaly want to disable debugging
|
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0beta1 on Sat Dec 15 22:25:09 2007 | http://epydoc.sourceforge.net |