You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This project seems to be well-suited for method call logging in debug builds. However, one of the drawbacks for this use case is that the listener is only provided with the function name and its arguments. While the fact that the function name is fully qualified helps with differentiating between different functions of the same name, without access to this:
It is not possible to differentiate between method calls on different objects of the same type. For instance, I have several Fragments in my app that are shown alongside each other, and I would like to know on which one of those the method was called.
It is not feasible to have custom loggers for objects.
I imagine that both of these problems could be solved with providing this to the listener. For instance, I could have an interface such as LoggerProvider { val logger: Logger }, that I could be slapping onto instances and companion objects, and in the listener I would be checking whether thisRef is LoggerProvider and act accordingly.
(I wonder if something similar could be done for file-level methods. Per-file loggers sounds like a great idea!)
(Maybe provide a list of this-es in case there are multiple?)
The text was updated successfully, but these errors were encountered:
This project seems to be well-suited for method call logging in debug builds. However, one of the drawbacks for this use case is that the listener is only provided with the function name and its arguments. While the fact that the function name is fully qualified helps with differentiating between different functions of the same name, without access to
this
:It is not possible to differentiate between method calls on different objects of the same type. For instance, I have several
Fragment
s in my app that are shown alongside each other, and I would like to know on which one of those the method was called.It is not feasible to have custom loggers for objects.
I imagine that both of these problems could be solved with providing
this
to the listener. For instance, I could have an interface such asLoggerProvider { val logger: Logger }
, that I could be slapping onto instances and companion objects, and in the listener I would be checking whetherthisRef is LoggerProvider
and act accordingly.(I wonder if something similar could be done for file-level methods. Per-file loggers sounds like a great idea!)
(Maybe provide a list of
this
-es in case there are multiple?)The text was updated successfully, but these errors were encountered: