Closed interrogator closed 4 years ago
This is pretty cool! Its definitely useful as a quick way to examine the code path of a 3rd party library. I'm not sure if there is a use-case for production code though, because most major modules have good logging of its own
Yeah, that's kind of what I'm thinking, it's cool, and could be useful for exploring a third party library ... but at the same time, not sure how useful exactly.
The plus side, is it's only a few lines of code, you just add an inspect.ismodule(decorated_thing)
and recursively apply loggo decorators to its classes, methods and functions. Right now, some edge cases cause it to break though, and if it isn't robust, we can't include it.
So, I will try a little more to get it working, but yeah, we're not there yet. Working on this I think actually helps me uncover some other possible bugs, so it's not gonna be time wasted :)
This is cool but never gonna go anywhere, so closing.
So it turns out it is fairly possible to decorate entire third party modules (with about 20 additional lines of code). Here is an example of what happens if you log everything that happens while building a pandas dataframe:
Right now doing some further operations with the dataframe can cause stack overflow (lol), but probably because i'm recursively decorating everything with Loggo. It should be possible to fix this so everything callable is decorated exactly once. But ... is it worth it?