structlog icon indicating copy to clipboard operation
structlog copied to clipboard

Add class name support for CallsiteParameterAdder

Open aucampia opened this issue 3 years ago • 3 comments

It may be nice to include support for class name in CallsiteParameterAdder, not sure how practical/easy it will be though, or how reliable it is to get the class name of the callsite.

Original request from @gzmarstone here: https://github.com/hynek/structlog/pull/380#issuecomment-995873510

I know its closed, but what about class if available as well... use case would be to find all of the logging calls in a particular class... You can check if the first arg is self, if it is then get the class and the name of that? I used this example to log the classname via structlog: https://stackoverflow.com/questions/2203424/python-how-to-retrieve-class-information-from-a-frame-object

aucampia avatar Dec 16 '21 15:12 aucampia

Sounds good! There won't be a 21.6 tho!!!! ;)

hynek avatar Dec 16 '21 17:12 hynek

JFTR, if you wanna tackle this, it might be a good time to start. I'm currently hounding @Tinche to follow through on a promise and would push 22.1 out right after.

hynek avatar Mar 10 '22 07:03 hynek

JFTR I looked at the linked solutions and holy shit unless we get a better way from Python core, this has to wait. 😅

hynek avatar Oct 17 '22 11:10 hynek