Bug 232654 - systrace template enanchement to support automatic parameter logging
Summary: systrace template enanchement to support automatic parameter logging
Status: RESOLVED DUPLICATE of bug 75407
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.4   Edit
Hardware: PC Linux
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-05-17 10:26 EDT by lorenzo CLA
Modified: 2008-05-19 05:08 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description lorenzo CLA 2008-05-17 10:26:22 EDT
Hi, I'd like to be able to call a "log_enter" template inside the following method

public void myMethod(String arg1, int arg2) {

    // ...
}

that should produce this result

public void myMethod(String arg1, int arg2) {

    logger.debug("entering myClass.myMethod(" + arg1 + ", " + arg2 ")");

    // ...
}

and a log_exit should add this line to all return points.

logger.debug("returning from myClass.myMethod with " + returnValue);

Now the ${enclosing_type} and ${enclosing_method} allow only part of this kind of logging. I found nothing like an ${enclosing_method_args} neither as a unique block neither as an "array".
Another thing that is missing is the possibility to specify a location for the code insertion like a location:method_start/method_exit and I suppose multiple code insertion is not supported.

Of course the actual logging text line should be customizable but this is already provided by the template functionality.

I think adding a ${enclosing_method_args} and a ${enclosing_method_return_value} keywords should be enough to provide 90% of the functionality, with the first one being the most important.
Maybe the "location" suggestion is not a good idea.

The actual formatting of the args could be a fixed one. In this case it would be nice to be able to use both "old style" string concatenation and a varargs call.

If some kind of iteration is provided the formatting could be defined "calling" another template.
So I could define the log_enter template in this way

logger.debug("entering ${enclosing_type}.${enclosing_method}(${call:format_args});

where format_args is another template with access to the same context of the caller where the actual formatting can take place.

Another example could be ${log_exception}: called inside a catch should be able to log the current exception, already possibile, and methods args.


Thanks, bye

Lorenzo
Comment 1 Dani Megert CLA 2008-05-19 05:08:52 EDT

*** This bug has been marked as a duplicate of bug 75407 ***