#NEWLINE# def get_structured_filter( name = '' , **kwargs ) : #NEWLINE# #INDENT# 'Returns a structured filter that injects contextual information into\n    log records.\n\n    Args:\n        kwargs (dict): The contextual information you wish to inject\n\n    See also:\n        :meth:`pygogo.Gogo.update_hdlr`\n\n    Returns:\n        New instance of :class:`pygogo.utils.StructuredFilter`\n\n    Examples:\n        >>> structured_filter = get_structured_filter(user=\'fred\')\n        >>> structured_filter  # doctest: +ELLIPSIS\n        <pygogo.utils...StructuredFilter object at 0x...>\n        >>>\n        >>> logger = logging.getLogger(\'structured_filter\')\n        >>> hdlr = logging.StreamHandler(sys.stdout)\n        >>> formatter = logging.Formatter(\'User %(user)s said, "%(message)s".\')\n        >>> hdlr.setFormatter(formatter)\n        >>> logger.addFilter(structured_filter)\n        >>> logger.addHandler(hdlr)\n        >>> logger.debug(\'A debug message\')\n        User fred said, "A debug message".\n\n    ' #NEWLINE# class StructuredFilter ( logging . Filter ) : #NEWLINE# #INDENT# '\n        Injects contextual information into log records.\n        ' #NEWLINE# def filter( self , record ) : #NEWLINE# #INDENT# 'Adds contextual information to a log record\n\n            Args:\n                record (obj): The event to contextualize\n\n            Returns:\n                bool: True\n            ' #NEWLINE# for ( k , v ) in kwargs . items ( ) : #NEWLINE# #INDENT# setattr ( record , k , v ) #NEWLINE# #UNINDENT# return True #NEWLINE# #UNINDENT# #UNINDENT# return StructuredFilter ( kwargs )