Codebase list logging-tree / 506351d
New upstream snapshot. Debian Janitor 2 years ago
9 changed file(s) with 170 addition(s) and 82 deletion(s). Raw diff Collapse all Expand all
+0
-24
.github/workflows/logging-tree-tests.yml less more
0 name: logging_tree tests
1
2 on:
3 push:
4 branches: [ master ]
5 pull_request:
6 branches: [ master ]
7
8 jobs:
9 build:
10 runs-on: ubuntu-18.04
11 strategy:
12 matrix:
13 python-version: [2.7, 3.4, 3.5, 3.6, 3.7, 3.8]
14
15 steps:
16 - uses: actions/checkout@v2
17 - name: Set up Python ${{ matrix.python-version }}
18 uses: actions/setup-python@v2
19 with:
20 python-version: ${{ matrix.python-version }}
21 - name: Test with unittest
22 run: |
23 python -m unittest logging_tree.tests.test_format logging_tree.tests.test_node
+0
-1
FUNDING.yml less more
0 github: brandon-rhodes
+0
-1
MANIFEST.in less more
0 include COPYRIGHT
0 Metadata-Version: 1.1
1 Name: logging_tree
2 Version: 1.9
3 Summary: Introspect and display the logger tree inside "logging"
4 Home-page: https://github.com/brandon-rhodes/logging_tree
5 Author: Brandon Rhodes
6 Author-email: brandon@rhodesmill.org
7 License: UNKNOWN
8 Description: Introspection for the ``logging`` logger tree in the Standard Library.
9
10 You can install this package with the standard ``pip`` command::
11
12 $ pip install logging_tree
13
14 While you can write programs that call this package's ``tree()``
15 function and examine the hierarchy of logger objects that it finds
16 inside of the Standard Library ``logging`` module, the simplest use of
17 this package for debugging is to call ``printout()`` to print the
18 loggers, filters, and handlers that your application has configured::
19
20 >>> logging.getLogger('a')
21 >>> logging.getLogger('a.b').setLevel(logging.DEBUG)
22 >>> logging.getLogger('x.c')
23 >>> from logging_tree import printout
24 >>> printout()
25 <--""
26 Level WARNING
27 |
28 o<--"a"
29 | Level NOTSET so inherits level WARNING
30 | |
31 | o<--"a.b"
32 | Level DEBUG
33 |
34 o<--[x]
35 |
36 o<--"x.c"
37 Level NOTSET so inherits level WARNING
38
39 If you instead want to write the tree diagram to a file, stream, or
40 other file-like object, use::
41
42 file_object.write(logging_tree.format.build_description())
43
44 The logger tree should always print successfully, no matter how
45 complicated. A node whose ``[name]`` is in square brackets is a "place
46 holder" that has never actually been named in a ``getLogger()`` call,
47 but was created automatically to serve as the parent of loggers further
48 down the tree.
49
50 There are several interfaces that ``logging_tree`` supports, depending
51 on how much detail you need.
52
53 ``logging_tree.printout(node=None)``
54
55 Prints the current logger tree, or the tree based at the given
56 `node`, to the standard output.
57
58 ``logging_tree.format.build_description(node=None)``
59
60 Builds and returns the multi-line description of the current logger
61 tree, or the tree based at the given ``node``, as a single string
62 with newlines inside and a newline at the end.
63
64 ``logging_tree.format.describe(node)``
65
66 A generator that yields a series of lines that describe the tree
67 based at the given ``node``. Note that the lines are returned
68 without newline terminators attached.
69
70 ``logging_tree.tree()``
71
72 Fetch the current tree of loggers from the ``logging`` module.
73 Returns a node, that is simply a tuple with three fields:
74
75 | ``[0]`` the logger name (``""`` for the root logger).
76 | ``[1]`` the ``logging.Logger`` object itself.
77 | ``[2]`` a list of zero or more child nodes.
78
79 I welcome contributions and ideas as this package matures. You can find
80 the bug tracker at the `repository page on github
81 <https://github.com/brandon-rhodes/logging_tree>`_. Developers can run
82 this package's tests with::
83
84 $ python -m unittest discover logging_tree
85
86 On older versions of Python you will instead have to install
87 ``unittest2`` and use its ``unit2`` command line tool to run the tests.
88
89 Changelog
90 ---------
91
92 **Version 1.9** - 2021 April 10
93 Declare compatibility with Python 3.9. Improve how the logging
94 module's built-in ``Formatter`` class is displayed under old Python
95 versions where the ``logging`` module uses old-style classes.
96
97 **Version 1.8.1** - 2020 January 26
98 Adjust one test to make it pass under Python 3.8, and update the
99 distribution classifiers to declare compatibility with Python
100 versions through 3.8.
101
102 **Version 1.8** - 2018 August 5
103 Improve the output to better explain what happens if a "parent"
104 attribute has been set to None.
105
106 **Version 1.7** - 2016 January 23
107 Detect whether each logger has the correct "parent" attribute and,
108 if not, print where its log messages are being sent instead.
109
110 **Version 1.6** - 2015 January 8
111 Fixed a crash that would occur if a custom logging Formatter was
112 missing its format string attributes.
113
114 **Version 1.5** - 2014 December 24
115 Handlers now display their logging level if one has been set, and
116 their custom logging formatter if one has been installed.
117
118 **Version 1.4** - 2014 January 8
119 Thanks to a contribution from Dave Brondsema, disabled loggers are
120 now actually marked as "Disabled" to make it less of a surprise that
121 they fail to log anything.
122
123 **Version 1.3** - 2013 October 29
124 Be explicit and display the logger level ``NOTSET`` along with the
125 effective level inherited from the logger's ancestors; and display
126 the list of ``.filters`` of a custom logging handler even though it
127 might contain custom code that ignores them.
128
129 **Version 1.2** - 2013 January 19
130 Compatible with Python 3.3 thanks to @ralphbean.
131
132 **Version 1.1** - 2012 February 17
133 Now compatible with 2.3 <= Python <= 3.2.
134
135 **Version 1.0** - 2012 February 13
136 Can display the handler inside a MemoryHandler; entire public
137 interface documented; 100% test coverage.
138
139 **Version 0.6** - 2012 February 10
140 Added a display format for every ``logging.handlers`` class.
141
142 **Version 0.5** - 2012 February 8
143 Initial release.
144
145
146 Platform: UNKNOWN
147 Classifier: Development Status :: 6 - Mature
148 Classifier: Intended Audience :: Developers
149 Classifier: License :: OSI Approved :: BSD License
150 Classifier: Programming Language :: Python :: 2.3
151 Classifier: Programming Language :: Python :: 2.4
152 Classifier: Programming Language :: Python :: 2.5
153 Classifier: Programming Language :: Python :: 2.6
154 Classifier: Programming Language :: Python :: 2.7
155 Classifier: Programming Language :: Python :: 3.2
156 Classifier: Programming Language :: Python :: 3.3
157 Classifier: Programming Language :: Python :: 3.4
158 Classifier: Programming Language :: Python :: 3.5
159 Classifier: Programming Language :: Python :: 3.6
160 Classifier: Programming Language :: Python :: 3.7
161 Classifier: Programming Language :: Python :: 3.8
162 Classifier: Programming Language :: Python :: 3.9
163 Classifier: Topic :: System :: Logging
+0
-15
README.md less more
0 Welcome to the `logging_tree` Python project repository!
1
2 You can install this package and read its documentation
3 at the project’s official entry on the Python Package Index:
4
5 https://pypi.python.org/pypi/logging_tree
6
7 On Debian Testing and Unstable, you can install the package for the
8 system Python versions with any of the standard Debian package tools:
9
10 $ sudo apt-get install python-logging-tree
11
12 The documentation is also available as the package docstring,
13 kept inside of the `logging_tree/__init__.py` file here in the
14 project repository.
0 logging-tree (1.9+git20210410.1.b2d7cee-1) UNRELEASED; urgency=low
1
2 * New upstream snapshot.
3
4 -- Debian Janitor <janitor@jelmer.uk> Mon, 04 Apr 2022 20:20:21 -0000
5
06 logging-tree (1.9-1) unstable; urgency=medium
17
28 * New upstream release
+0
-10
release.sh less more
0 #!/bin/bash
1
2 set -e
3
4 python3 setup.py sdist upload || true
5
6 sed -i '1iimport setuptools' setup.py
7 python3 setup.py bdist_wheel upload || true
8 git checkout setup.py
9 rm -r build logging_tree.egg-info
+0
-18
test.sh less more
0 #!/bin/bash
1 #
2 # This merely tests that `logging_tree` works when run directly from
3 # source (and, of course, only tests the versions of Python you happen
4 # to have installed with pyenv). For a comprehensive test of whether it
5 # will actually work if installed from its distribution, see `tox.ini`.
6
7 for python in ~/.pyenv/versions/*/bin/python
8 do
9 echo
10 echo ======================================================================
11 echo $python
12 echo ======================================================================
13 for test in logging_tree/tests/test_*.py
14 do
15 PYTHONPATH=. $python $test
16 done
17 done
+0
-13
tox.ini less more
0 # To test against as many versions of Python as feasible, I run:
1 #
2 # tox --discover ~/.pyenv/versions/*/bin/python
3 #
4 # Unfortunately tox has lost its ability to detect older versions of
5 # Python like 2.6 (much less 2.3 or 2.4); see the accompanying `test.sh`
6 # script for an alternative.
7
8 [tox]
9 envlist = py27,py36,py37,py38,py39
10 [testenv]
11 commands =
12 python -m unittest discover logging_tree