I would like the output of python log to be in the form of a tree corresponding to the logger tree. Just look at an example.
Let's say we have a code:
import logging logger_a = logging.getLogger("a") logger_a_b = logging.getLogger("ab") logger_a_b_c = logging.getLogger("abc") # ... logger_a.debug("One") logger_a_b.warning("two") logger_a_b.warning("three") logger_a_b_c.critical("Four") logger_a_b.warning("Five")
The result should look something like this:
<--"a" | DEBUG: One | o<--"ab" | | WARNING: Two | | WARNING: Three | | | o<--"abc" | | CRITICAL: Four | | | | WARNING: Five
I could write formatters for each of the logs manually, but this does not solve the problem of inserting something like o <- "ab" to the right, and I would prefer to automatically calculate the offset from the logging structure.
There is a module called the logging tree . He prints a logging layout. I would like to print log messages about the same.
Do you know any libraries, ways to do this easily?
source share