(self,log="",prefix=True)
Selectively enable log hooks depending on log argument
            (comma separated list of hooks to enable/disable)

            - If empty enable default log hooks
            - If entry starts with '+' (eg. +send,+recv) enable hook
            - If entry starts with '-' (eg. -data) disable hook
            - If entry doesn't start with +/- replace defaults

            Prefix argument enables/disables log prefix
Selectively enable log hooks depending on log argument
            (comma separated list of hooks to enable/disable)
Selectively enable log hooks depending on log argument ( comma separated list of hooks to enable / disable )
def __init__(self,log="",prefix=True):
        """
            Selectively enable log hooks depending on log argument
            (comma separated list of hooks to enable/disable)

            - If empty enable default log hooks
            - If entry starts with '+' (eg. +send,+recv) enable hook
            - If entry starts with '-' (eg. -data) disable hook
            - If entry doesn't start with +/- replace defaults

            Prefix argument enables/disables log prefix
        """
        default = ["request","reply","truncated","error"]
        log = log.split(",") if log else []
        enabled = set([ s for s in log if s[0] not in '+-'] or default)
        [ enabled.add(l[1:]) for l in log if l.startswith('+') ]
        [ enabled.discard(l[1:]) for l in log if l.startswith('-') ]
        for l in ['log_recv','log_send','log_request','log_reply',
                  'log_truncated','log_error','log_data']:
            if l[4:] not in enabled:
                setattr(self,l,self.log_pass)
        self.prefix = prefix
def __init__ ( self , log = "" , prefix = True ) : default = [ "request" , "reply" , "truncated" , "error" ] log = log . split ( "," ) if log else [ ] enabled = set ( [ s for s in log if s [ 0 ] not in '+-' ] or default ) [ enabled . add ( l [ 1 : ] ) for l in log if l . startswith ( '+' ) ] [ enabled . discard ( l [ 1 : ] ) for l in log if l . startswith ( '-' ) ] for l in [ 'log_recv' , 'log_send' , 'log_request' , 'log_reply' , 'log_truncated' , 'log_error' , 'log_data' ] : if l [ 4 : ] not in enabled : setattr ( self , l , self . log_pass ) self . prefix = prefix