xmpp.debug

Package xmpp :: Module debug |
[hide private]
[frames] | no frames]

# Module debug

source code

Classes | [hide private]
| NoDebug
| Debug

Variables | [hide private]
| _version_ = ``'``1.4.0``'`` Generic debug class
| colors_enabled = `True`
| color_none = ``'``\x1b[0m``'``
| color_black = ``'``\x1b[30m``'``
| color_red = ``'``\x1b[31m``'``
| color_green = ``'``\x1b[32m``'``
| color_brown = ``'``\x1b[33m``'``
| color_blue = ``'``\x1b[34m``'``
| color_magenta = ``'``\x1b[35m``'``
| color_cyan = ``'``\x1b[36m``'``
| color_light_gray = ``'``\x1b[37m``'``
| color_dark_gray = ``'``\x1b[30;1m``'``
| color_bright_red = ``'``\x1b[31;1m``'``
| color_bright_green = ``'``\x1b[32;1m``'``
| color_yellow = ``'``\x1b[33;1m``'``
| color_bright_blue = ``'``\x1b[34;1m``'``
| color_purple = ``'``\x1b[35;1m``'``
| color_bright_cyan = ``'``\x1b[36;1m``'``
| color_white = ``'``\x1b[37;1m``'`` Define your flags in yor modules like this:...
| LINE_FEED = ``'``\n``'``
| DBG_ALWAYS = ``'``always``'``
| DEBUGGING_IS_ON = `1`

Variables Details | [hide private]

  ### _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 Value:
      '1.4.0'

### color_white
    Define 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
  Value:
      '\x1b[37;1m'