I'm making my first steps in Android development and to understand things like the lifecycle of a Fragment I'm using methods which have calls to a logger as the first line, such as
@Override
public void onCreate(Bundle savedInstanceState) {
logger.debug("> onCreate(" + savedInstanceState + ")");
...
}
That works fine, except adding those messages to each method is rather cumbersome and it makes the code a bit hard to read. I found out that with AspectJ and other tools such as jcabi-aspects one could use something like this instead:
@Loggable(Loggable.DEBUG)
public String load(URL url) {
return url.openConnection().getContent();
}
which would print:
[DEBUG] #load('http://www.google.com'): returned "<html ..." in 23ms
That sounds pretty cool, but how do I go about adding this functionality to Android Studio? I could find a guide for Eclipse and this IntelliJ help page (but not the mentioned plugins), and I'm at loss. I'd welcome a mini-guide on how to get started with AspectJ (and perhaps jcabi-aspects).