This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Implement introspection of logger hierarchy
Type: enhancement Stage: patch review
Components: Library (Lib) Versions: Python 3.4
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: vinay.sajip Nosy List: brandon-rhodes, pitrou, r.david.murray, vinay.sajip
Priority: normal Keywords: patch

Created on 2013-04-27 12:48 by vinay.sajip, last changed 2022-04-11 14:57 by admin. This issue is now closed.

File name Uploaded Description Edit
initial-patch.diff vinay.sajip, 2013-04-27 16:28 Initial attempt to provide introspection functionality review
Repositories containing patches
Messages (6)
msg187904 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2013-04-27 12:48
Track implementation of logger hierarchy introspection as per
msg187914 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2013-04-27 16:33
Added Brandon to nosy list, as his logging_tree is what set the ball rolling on this one. Brandon, your comments on the patch would be very welcome.
msg188414 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-05-04 22:12
Perhaps you should explain what the point of this is.
msg188419 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2013-05-05 01:20
I think that's what the link in the first message does.  However, as I remember Bradon's talk, the short answer is: make it easy to discover (and therefore reason about) the hierarchy of logging objects that results from all the logging setup calls in an application.
msg190463 - (view) Author: Brandon Rhodes (brandon-rhodes) * Date: 2013-06-02 01:28
Adding an entirely separate API for introspection strikes me as counter-productive — instead of merely having to maintain the logging API that you already maintain, you will additionally now have an entirely separate and second API that also has to be maintained forever.

Reading back over the current logging documentation, it looks like the problem is that the documentation only includes verbs — the methods that can be invoked — but not adjectives: the attributes that are attached to each logger, handler, and filter. This is contrary to modern Python APIs, which typically document their attributes and offer direct access to them; within the Standard Library, cf the threading.Thread object for one that has done a good job of moving into the modern world with directly-accessible attributes.

So my guess would be that you should discard the idea of a separate introspection API, and simply document that attributes of each logger, handler, and filter that today are already perfectly introspectable. Check out the logging_tree code if you want to make sure that you are “promoting” into document-hood all of the attributes that I needed in order to do my introspecting there.
msg213525 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2014-03-14 08:58
Taking Brandon's advice re. creating a separate API.

However, note the reasons for not documenting all the attributes and hiding them behind functions: logging's design pre-dates properties (it's of Python 1.5.2 vintage) and implementation details should remain as hidden as they can be, given Python's essentially non-private nature (even though they are unlikely to change after all this time, you never know ...)
Date User Action Args
2022-04-11 14:57:45adminsetgithub: 62055
2014-03-14 08:58:45vinay.sajipsetstatus: open -> closed
resolution: rejected
messages: + msg213525
2013-06-02 01:28:59brandon-rhodessetmessages: + msg190463
2013-05-05 01:20:25r.david.murraysetnosy: + r.david.murray
messages: + msg188419
2013-05-04 22:12:37pitrousetnosy: + pitrou
messages: + msg188414
2013-04-27 16:33:41vinay.sajipsetnosy: + brandon-rhodes

messages: + msg187914
stage: patch review
2013-04-27 16:28:22vinay.sajipsetfiles: + initial-patch.diff
keywords: + patch
2013-04-27 16:27:54vinay.sajipsethgrepos: + hgrepo186
2013-04-27 12:48:58vinay.sajipcreate