Skip to content
This repository has been archived by the owner on Jan 25, 2024. It is now read-only.

Add DEBUG-level logging of all Interface method calls #369

Merged
merged 1 commit into from
Aug 6, 2019

Conversation

kierdavis
Copy link
Contributor

This uses some funky introspection whenever a Backend is registered to:

  • get all of the interfaces it implements
  • get all of the abstract methods of these interfaces (component-backend interactions)
  • install a wrapper around each method
  • use the call signature of the method to get a mapping of the arguments to the call with both names and values
  • log the method name, arguments and return value...
  • ...to the logger named by the module that the interface is defined in!

This code contains copious amounts of black magic. Perhaps manually
adding log messages to every interface method would have been a more
obvious if less efficient solution.


Since writing this I think it might be too verbose for typical debugging efforts. Thoughts on defining a new log level below DEBUG e.g. TRACE?

This uses some funky introspection whenever a Backend is registered to:
* get all of the interfaces it implements
* get all of the abstract methods of these interfaces (component-backend interactions)
* install a wrapper around each method
* use the call signature of the method to get a mapping of the arguments to the call with both names and values
* log the method name, arguments and return value...
* ...to the logger named by the module that the interface is defined in!

This code contains copious amounts of black magic. Perhaps manually
adding log messages to every interface method would have been a more
obvious if less efficient solution.
@codeclimate
Copy link

codeclimate bot commented Aug 6, 2019

Code Climate has analyzed commit 807db9b and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (95% is the threshold).

This pull request will bring the total coverage in the repository to 89.1% (0.0% change).

View more on Code Climate.

@kierdavis kierdavis mentioned this pull request Aug 6, 2019
@trickeydan
Copy link
Contributor

This is both nice and not nice.

I'm happy to ship it for now, but I'd like to review whether we will want it in a month

As for verboseness, j5 won't have any other level, so I'm unsure what to do. @sedders123 @RealOrangeOne opinions?

Copy link
Contributor

@trickeydan trickeydan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running low on time. Let's ship it.

@kierdavis
Copy link
Contributor Author

I've opened #370 to track cleaning this up at a later date.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants