:py:mod:`logz` ============== .. py:module:: conda.auxlib.logz Classes ------- .. autoapisummary:: conda.auxlib.logz.DumpEncoder Functions --------- .. autoapisummary:: conda.auxlib.logz.set_root_level conda.auxlib.logz.attach_stderr conda.auxlib.logz.detach_stderr conda.auxlib.logz.initialize_logging conda.auxlib.logz.jsondumps conda.auxlib.logz.fullname conda.auxlib.logz.request_header_sort_key conda.auxlib.logz.response_header_sort_key conda.auxlib.logz.stringify Attributes ---------- .. autoapisummary:: conda.auxlib.logz.root_log conda.auxlib.logz.NullHandler conda.auxlib.logz.DEBUG_FORMATTER conda.auxlib.logz.INFO_FORMATTER conda.auxlib.logz._DUMPS conda.auxlib.logz.request_header_sort_dict conda.auxlib.logz.response_header_sort_dict .. py:data:: root_log .. py:data:: NullHandler .. py:data:: DEBUG_FORMATTER .. py:data:: INFO_FORMATTER .. py:function:: set_root_level(level=INFO) .. py:function:: attach_stderr(level=INFO) .. py:function:: detach_stderr() .. py:function:: initialize_logging(level=INFO) .. py:class:: DumpEncoder(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None) Bases: :py:obj:`json.JSONEncoder` Extensible JSON encoder for Python data structures. Supports the following objects and types by default: +-------------------+---------------+ | Python | JSON | +===================+===============+ | dict | object | +-------------------+---------------+ | list, tuple | array | +-------------------+---------------+ | str | string | +-------------------+---------------+ | int, float | number | +-------------------+---------------+ | True | true | +-------------------+---------------+ | False | false | +-------------------+---------------+ | None | null | +-------------------+---------------+ To extend this to recognize other objects, subclass and implement a ``.default()`` method with another method that returns a serializable object for ``o`` if possible, otherwise it should call the superclass implementation (to raise ``TypeError``). .. py:method:: default(obj) Implement this method in a subclass such that it returns a serializable object for ``o``, or calls the base implementation (to raise a ``TypeError``). For example, to support arbitrary iterators, you could implement default like this:: def default(self, o): try: iterable = iter(o) except TypeError: pass else: return list(iterable) # Let the base class default method raise the TypeError return JSONEncoder.default(self, o) .. py:data:: _DUMPS .. py:function:: jsondumps(obj) .. py:function:: fullname(obj) .. py:data:: request_header_sort_dict .. py:function:: request_header_sort_key(item) .. py:data:: response_header_sort_dict .. py:function:: response_header_sort_key(item) .. py:function:: stringify(obj, content_max_len=0)