neo4j / neo4j-python-driver

Neo4j Bolt driver for Python
https://neo4j.com/docs/api/python-driver/current/
Other
883 stars 187 forks source link

[4.4] Improve logging helper `neo4j.debug.watch()` #1032

Closed robsdedude closed 3 months ago

robsdedude commented 3 months ago

The helper did not handle logging level correctly. For example

neo4j.debug.watch("neo4j", out=sys.stdout)
neo4j.debug.watch("neo4j", out=sys.stderr, level=logging.WARNING)

would've caused the logging level of the "neo4j" logger to end up being WARNING even though the first call (implicitly) requested DEBUG.

The fix will make sure to set the logger's level to the most verbose requested level and use a level filter on the Handlers registered for each call to filter on the level accordingly.

Backport of https://github.com/neo4j/neo4j-python-driver/pull/946