Module Expr Str ImportFrom alias alias alias alias alias Import alias Import alias ImportFrom alias ImportFrom alias Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam defaults body Expr Str If Call NameLoad NameLoad Str body Assign NameStore Call NameLoad NameLoad orelse If Call NameLoad NameLoad Str body Assign NameStore Call NameLoad NameLoad orelse If Call AttributeLoad Call NameLoad ListLoad Str Str Str attr Call NameLoad NameLoad body Assign NameStore Call NameLoad NameLoad orelse Assign NameStore Call NameLoad NameLoad Return NameLoad decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam defaults NameLoad kwarg body Expr Str Assign SubscriptStore NameLoad Index Str NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Return Call NameLoad Call AttributeLoad Call NameLoad attr AttributeLoad NameLoad attr decorator_list decorator_list ClassDef bases AttributeLoad NameLoad attr body Expr Str FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Str Dict Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign SubscriptStore NameLoad Index Str NameLoad Return TupleLoad Call NameLoad Call NameLoad NameLoad NameLoad NameLoad decorator_list decorator_list ClassDef bases AttributeLoad NameLoad attr body Expr Str FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Return CompareLt AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list decorator_list FunctionDef arguments args NameParam defaults Str kwarg body Expr Str ClassDef bases AttributeLoad NameLoad attr body Expr Str FunctionDef arguments args NameParam NameParam defaults body Expr Str For TupleStore NameStore NameStore Call AttributeLoad NameLoad attr body Expr Call NameLoad NameLoad NameLoad NameLoad Return NameLoad decorator_list decorator_list Return Call NameLoad NameLoad decorator_list
N/A N/A 
pygogo.utils
~~~~~~~~~~~~

Misc classes and functions that don't warrant their own module

Examples:
    basic usage::

        >>> CustomEncoder().encode(range(5))
        '[0, 1, 2, 3, 4]'

 __future__ absolute_import division print_function with_statement unicode_literals N/A logging N/A sys json JSONEncoder builtins * N/A module_hdlr N/A N/A logging StreamHandler N/A sys stdout N/A module_logger N/A N/A logging getLogger __name__ N/A N/A N/A module_logger addHandler module_hdlr CustomEncoder N/A JSONEncoder N/A N/A A unicode aware JSON encoder that can handle iterators, dates, and times

    Examples:
        >>> CustomEncoder().encode(range(5))
        '[0, 1, 2, 3, 4]'
        >>> from json import dumps
        >>> dumps(range(5), cls=CustomEncoder)
        '[0, 1, 2, 3, 4]'
     default N/A N/A self obj N/A N/A N/A  Encodes a given object

        Args:
            obj (scalar): The object to encode.

        Returns:
            The encoded object

        Examples:
            >>> CustomEncoder().default(range(5))
            [0, 1, 2, 3, 4]
         N/A N/A hasattr obj real N/A N/A encoded N/A float obj N/A N/A N/A hasattr obj union N/A N/A encoded N/A tuple obj N/A N/A N/A N/A N/A set N/A next union __iter__ intersection N/A dir obj N/A N/A encoded N/A list obj N/A N/A encoded N/A str obj N/A encoded N/A N/A StructuredMessage N/A object N/A N/A Converts a message and kwargs to a json string

    Attributes:
        kwargs (dict): Keyword arguments passed to
            :class:`~pygogo.utils.CustomEncoder`.

    Args:
        message (string): The message to log.

        kwargs (dict): Keyword arguments passed to
            :class:`~pygogo.utils.CustomEncoder`.

    Returns:
        New instance of :class:`StructuredMessage`

    See also:
        :class:`pygogo.utils.StructuredAdapter`

    Examples:
        >>> from json import loads

        >>> msg = StructuredMessage('hello world', key='value')
        >>> loads(str(msg)) == {'message': 'hello world', 'key': 'value'}
        True
     __init__ N/A N/A self message N/A None kwargs N/A N/A Initialization method.

        Args:
            message (string): The message to log.

            kwargs (dict): Keyword arguments passed to
                :class:`~pygogo.utils.CustomEncoder`.

        Returns:
            New instance of :class:`StructuredMessage`

        Examples:
            >>> StructuredMessage('message')  # doctest: +ELLIPSIS
            <pygogo.utils.StructuredMessage object at 0x...>
         N/A N/A kwargs N/A message message N/A N/A self kwargs kwargs N/A __str__ N/A N/A self N/A N/A N/A  String method

        Returns:
            str: The encoded object

        Examples
            >>> from json import loads

            >>> msg = str(StructuredMessage('hello world', key='value'))
            >>> loads(msg) == {'message': 'hello world', 'key': 'value'}
            True

         N/A N/A str N/A N/A N/A CustomEncoder encode N/A self kwargs N/A N/A StructuredAdapter N/A N/A logging LoggerAdapter N/A N/A A logging adapter that creates a json string from a log message and the
    `extra` kwarg

    See also:
        :class:`pygogo.utils.StructuredMessage`

        :meth:`pygogo.Gogo.get_structured_logger`

    Examples:
        >>> from io import StringIO
        >>> from json import loads

        >>> s = StringIO()
        >>> logger = logging.getLogger()
        >>> hdlr = logging.StreamHandler(s)
        >>> logger.addHandler(hdlr)
        >>> structured_logger = StructuredAdapter(logger, {'all': True})
        >>> structured_logger.debug('hello', extra={'key': u'value'})
        >>> loads(s.getvalue()) == {
        ...     'all': True, 'message': 'hello', 'key': 'value'}
        True
     process N/A N/A self msg kwargs N/A N/A N/A  Modifies the message and/or keyword arguments passed to a logging
        call in order to insert contextual information.

        Args:
            msg (str): The message to log.
            kwargs (dict):

        Returns:
            Tuple of (:class:`~pygogo.utils.StructuredMessage`, modified kwargs)

        Examples:
            >>> from json import loads

            >>> logger = logging.getLogger()
            >>> structured_logger = StructuredAdapter(logger, {'all': True})
            >>> extra = {'key': 'value'}
            >>> m, k = structured_logger.process('message', {'extra': extra})
            >>> loads(m) == {'all': True, 'message': 'message', 'key': 'value'}
            True
            >>> k == {'extra': {'all': True, 'key': 'value'}}
            True
         N/A extra N/A N/A kwargs get extra N/A N/A N/A N/A extra update N/A self extra N/A N/A kwargs N/A extra extra N/A N/A N/A str N/A StructuredMessage msg extra kwargs N/A N/A LogFilter N/A N/A logging Filter N/A N/A Filters log messages depending on level

    Attributes:
        level (int): The logging level.

            +-------------------------+-------+
            | logging level attribute | value |
            +=========================+=======+
            | CRITICAL                | 50    |
            +-------------------------+-------+
            | ERROR                   | 40    |
            +-------------------------+-------+
            | WARNING                 | 30    |
            +-------------------------+-------+
            | INFO                    | 20    |
            +-------------------------+-------+
            | DEBUG                   | 10    |
            +-------------------------+-------+
            | NOTSET                  |  0    |
            +-------------------------+-------+

    Args:
        level (int): The logging level.

    Returns:
        New instance of :class:`LogFilter`

    See also:
        :meth:`pygogo.Gogo.update_hdlr`
     __init__ N/A N/A self level N/A N/A N/A Initialization method.

        Args:
            level (int): The logging level.

        Returns:
            New instance of :class:`LogFilter`

        Examples:
            >>> LogFilter(40)  # doctest: +ELLIPSIS
            <pygogo.utils.LogFilter object at 0x...>
         N/A N/A self high_level level N/A filter N/A N/A self record N/A N/A N/A Determines whether or a not a message should be logged.

        Args:
            record (obj): The event to (potentially) log

        Returns:
            bool: True if the event level is lower than self.high_level

        Examples:
            >>> attrs = {'levelno': logging.INFO}
            >>> record = logging.makeLogRecord(attrs)
            >>> LogFilter(40).filter(record)
            True
         N/A N/A N/A record levelno N/A self high_level N/A N/A get_structured_filter N/A N/A name N/A kwargs N/A N/A Returns a structured filter that injects contextual information into
    log records.

    Args:
        kwargs (dict): The contextual information you wish to inject

    See also:
        :meth:`pygogo.Gogo.update_hdlr`

    Returns:
        New instance of :class:`pygogo.utils.StructuredFilter`

    Examples:
        >>> structured_filter = get_structured_filter(user='fred')
        >>> structured_filter  # doctest: +ELLIPSIS
        <pygogo.utils...StructuredFilter object at 0x...>
        >>>
        >>> logger = logging.getLogger('structured_filter')
        >>> hdlr = logging.StreamHandler(sys.stdout)
        >>> formatter = logging.Formatter('User %(user)s said, "%(message)s".')
        >>> hdlr.setFormatter(formatter)
        >>> logger.addFilter(structured_filter)
        >>> logger.addHandler(hdlr)
        >>> logger.debug('A debug message')
        User fred said, "A debug message".

     StructuredFilter N/A N/A logging Filter N/A N/A 
        Injects contextual information into log records.
         filter N/A N/A self record N/A N/A N/A Adds contextual information to a log record

            Args:
                record (obj): The event to contextualize

            Returns:
                bool: True
             N/A N/A k v N/A N/A kwargs items N/A N/A N/A setattr record k v N/A True N/A N/A N/A N/A StructuredFilter name N/A