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

Class Debug

source code

Instance Methods [hide private]
 
__init__(self, active_flags=None, log_file=sys.stderr, prefix='DEBUG: ', sufix='\n', time_stamp=0, flag_show=None, validate_flags=1, welcome=-1) source code
 
show(self, msg, flag=None, prefix=None, sufix=None, lf=0)
flag can be of folowing types:...
source code
 
active_set(self, active_flags=None)
returns 1 if any flags where actually set, otherwise 0.
source code
 
active_get(self)
returns currently active flags.
source code
 
_as_one_list(self, items)
init param might contain nested lists, typically from group flags.
source code
 
_append_unique_str(self, lst, item)
filter out any dupes.
source code
 
_validate_flag(self, flags)
verify that flag is defined.
source code
 
_remove_dupe_flags(self)
if multiple instances of Debug is used in same app, some flags might be created multiple time, filter out dupes
source code
 
Show(self, flag, msg, prefix='') source code
 
is_active(self, flag) source code
Class Variables [hide private]
  colors = {'CONNECTproxy': '\x1b[30;1m', 'auth': '\x1b[33;1m', ...
Method Details [hide private]

show(self, msg, flag=None, prefix=None, sufix=None, lf=0)

source code 

flag can be of folowing types:
    None - this msg will always be shown if any debugging is on
    flag - will be shown if flag is active
    (flag1,flag2,,,) - will be shown if any of the given flags 
                       are active

if prefix / sufix are not given, default ones from init will be used

lf = -1 means strip linefeed if pressent
lf = 1 means add linefeed if not pressent

_as_one_list(self, items)

source code 

init param might contain nested lists, typically from group flags.

This code organises lst and remves dupes

Class Variable Details [hide private]

colors

Value:
{'CONNECTproxy': '\x1b[30;1m',
 'auth': '\x1b[33;1m',
 'browser': '\x1b[34m',
 'client': '\x1b[36m',
 'component': '\x1b[36m',
 'data': '\x1b[33m',
 'dispatcher': '\x1b[32m',
 'down': '\x1b[33m',
...