The `logging-tree` library provides a simple way to introspect and display the logger hierarchy from Python's built-in `logging` module. It helps developers visualize how loggers are configured, including their levels and handlers. The current version is 1.10, with releases occurring periodically to add minor features or address issues.
pip install logging-treeVerified import paths — ran on the pinned version, not inferred.
This example configures a basic logging hierarchy and then uses `logging_tree.printout()` to display the structure of all active loggers, their levels, and handlers.
If you need to capture the output, pass a `file` object to `printout()`, e.g., `printout(file=my_file_object)`, or redirect `sys.stdout`.
Ensure that your application explicitly retrieves and potentially configures named loggers (e.g., `logging.getLogger('my_app')`) before calling `printout()` to see a detailed tree.Use `printout()` directly instead of `main()` for displaying the logging tree.
Run `pip install logging-tree` to install the library.
To redirect the output, use the `file` argument: `from io import StringIO; output = StringIO(); printout(file=output); tree_string = output.getvalue()`.
Ensure that named loggers are created and active before calling `printout()`. Also, verify that you are indeed defining distinct loggers beyond the root. For example, explicitly call `logging.getLogger('my_app')` at some point in your code.No dependency data recorded yet.