geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ted Kirby <ted.ki...@gmail.com>
Subject Re: svn commit: r733149 - in /geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins: org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/internal/ org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/ org.apa
Date Mon, 12 Jan 2009 06:14:57 GMT
oh yeah... good job! :-)  Does each trace call produce one line of
output?  If so, StringBuilder could be used to replicate the original
behaviour.

On Sun, Jan 11, 2009 at 5:11 PM, Tim McConnell <tim.mcconne@gmail.com> wrote:
> Hi Ted, yes that's exactly what I changed. I removed the separate methods
> and replaced with "Object... parms"
>
> Ted Kirby wrote:
>>
>> Wouldn't you rather use varargs for tracePoint, versus seperate
>> methods for 1-5 parameters?
>>
>> Ted
>>
>> On Fri, Jan 9, 2009 at 3:44 PM,  <mcconne@apache.org> wrote:
>>>
>>> Author: mcconne
>>> Date: Fri Jan  9 12:44:26 2009
>>> New Revision: 733149
>>>
>>> URL: http://svn.apache.org/viewvc?rev=733149&view=rev
>>> Log:
>>> Make trace logic more concise and trace output easier to read
>>>
>>> Modified:
>>>
>>> geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/internal/Trace.java
>>>
>>> geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Trace.java
>>>
>>> geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/internal/Trace.java
>>>
>>> Modified:
>>> geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/internal/Trace.java
>>> URL:
>>> http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/internal/Trace.java?rev=733149&r1=733148&r2=733149&view=diff
>>>
>>> ==============================================================================
>>> ---
>>> geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/internal/Trace.java
>>> (original)
>>> +++
>>> geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/internal/Trace.java
>>> Fri Jan  9 12:44:26 2009
>>> @@ -25,60 +25,60 @@
>>>  */
>>>  public class Trace {
>>>
>>> -       /**
>>> -        * Finest trace event.
>>> -        */
>>> -       public static byte INFO = 0;
>>> -
>>> -       /**
>>> -        * Warning trace event.
>>> -        */
>>> -       public static byte WARNING = 1;
>>> -
>>> -       /**
>>> -        * Severe trace event.
>>> -        */
>>> -       public static byte SEVERE = 2;
>>> -
>>> -       /**
>>> -        * Trace constructor comment.
>>> -        */
>>> -       private Trace() {
>>> -               super();
>>> -       }
>>> -
>>> -       /**
>>> -        * Trace the given text.
>>> -        *
>>> -        * @param level
>>> -        *            the trace level
>>> -        * @param s
>>> -        *            a message
>>> -        */
>>> -       public static void trace(byte level, String s) {
>>> -               trace(level, s, null, false);
>>> -       }
>>> -
>>> -       public static void trace(byte level, String s, boolean newLine) {
>>> -               trace(level, s, null, newLine);
>>> -       }
>>> -
>>> -       public static void trace(byte level, String s, Throwable t) {
>>> -               trace(level, s, null, false);
>>> -       }
>>> -
>>> -       public static void trace(byte level, String s, Throwable t,
>>> boolean newLine) {
>>> -               if (Activator.getDefault() == null ||
>>> !Activator.getDefault().isDebugging())
>>> -                       return;
>>> -
>>> -               if(newLine) {
>>> -                       System.out.println();
>>> -               }
>>> -
>>> -               System.out.println(Activator.PLUGIN_ID + ":  " + s);
>>> -               if (t != null)
>>> -                       t.printStackTrace();
>>> -       }
>>> +    /**
>>> +     * Finest trace event.
>>> +     */
>>> +    public static byte INFO = 0;
>>> +
>>> +    /**
>>> +     * Warning trace event.
>>> +     */
>>> +    public static byte WARNING = 1;
>>> +
>>> +    /**
>>> +     * Severe trace event.
>>> +     */
>>> +    public static byte SEVERE = 2;
>>> +
>>> +    /**
>>> +     * Trace constructor comment.
>>> +     */
>>> +    private Trace() {
>>> +        super();
>>> +    }
>>> +
>>> +    /**
>>> +     * Trace the given text.
>>> +     *
>>> +     * @param level
>>> +     *            the trace level
>>> +     * @param s
>>> +     *            a message
>>> +     */
>>> +    public static void trace(byte level, String s) {
>>> +        trace(level, s, null, false);
>>> +    }
>>> +
>>> +    public static void trace(byte level, String s, boolean newLine) {
>>> +        trace(level, s, null, newLine);
>>> +    }
>>> +
>>> +    public static void trace(byte level, String s, Throwable t) {
>>> +        trace(level, s, null, false);
>>> +    }
>>> +
>>> +    public static void trace(byte level, String s, Throwable t, boolean
>>> newLine) {
>>> +        if (Activator.getDefault() == null ||
>>> !Activator.getDefault().isDebugging())
>>> +            return;
>>> +
>>> +        if(newLine) {
>>> +            System.out.println();
>>> +        }
>>> +
>>> +        System.out.println(Activator.PLUGIN_ID + ":  " + s);
>>> +        if (t != null)
>>> +            t.printStackTrace();
>>> +    }
>>>
>>>    /**
>>>     * Trace the given message
>>> @@ -89,38 +89,25 @@
>>>     * @param classDotMethod
>>>     *            The class name + method name (e.g., "Class.method()")
>>>     *
>>> -     * @param parm1,2,3,4,5
>>> -     *            Method parameters if the trace point is an "Entry"
>>> +     * @param parms
>>> +     *            Method parameter(s) if the trace point is an "Entry"
>>>     *            or
>>>     *            Return value if the trace point is an "Exit"
>>>     */
>>>    public static void tracePoint(String tracePoint, String
>>> classDotMethod) {
>>>        trace(Trace.INFO, tracePoint + ": " + classDotMethod + "()" );
>>>    }
>>> -    public static void tracePoint(String tracePoint, String
>>> classDotMethod, Object parm1) {
>>> -        trace(Trace.INFO, tracePoint + ": " + classDotMethod + "(
>>> parm1=[" + (parm1 == null ? null : parm1.toString()) + "] )" );
>>> -    }
>>> -
>>> -    public static void tracePoint(String tracePoint, String
>>> classDotMethod, Object parm1, Object parm2) {
>>> -        trace(Trace.INFO, tracePoint + ": " + classDotMethod + "(
>>> parm1=[" + (parm1 == null ? null : parm1.toString()) + "], " +
>>> -
>>> "parm2=[" + (parm2 == null ? null : parm2.toString()) + "] )" );
>>> -    }
>>> -    public static void tracePoint(String tracePoint, String
>>> classDotMethod, Object parm1, Object parm2, Object parm3) {
>>> -        trace(Trace.INFO, tracePoint + ": " + classDotMethod + "(
>>> parm1=[" + (parm1 == null ? null : parm1.toString()) + "], " +
>>> -
>>> "parm2=[" + (parm2 == null ? null : parm2.toString()) + "], " +
>>> -
>>> "parm3=[" + (parm3 == null ? null : parm3.toString()) + "] )" );
>>> -    }
>>> -    public static void tracePoint(String tracePoint, String
>>> classDotMethod, Object parm1, Object parm2, Object parm3, Object parm4) {
>>> -        trace(Trace.INFO, tracePoint + ": " + classDotMethod + "(
>>> parm1=[" + (parm1 == null ? null : parm1.toString()) + "], " +
>>> -
>>> "parm2=[" + (parm2 == null ? null : parm2.toString()) + "], " +
>>> -
>>> "parm3=[" + (parm3 == null ? null : parm3.toString()) + "], " +
>>> -
>>> "parm4=[" + (parm4 == null ? null : parm4.toString()) + "] )" );
>>> -    }
>>> -    public static void tracePoint(String tracePoint, String
>>> classDotMethod, Object parm1, Object parm2, Object parm3, Object parm4,
>>> Object parm5) {
>>> -        trace(Trace.INFO, tracePoint + ": " + classDotMethod + "(
>>> parm1=[" + (parm1 == null ? null : parm1.toString()) + "], " +
>>> -
>>> "parm2=[" + (parm2 == null ? null : parm2.toString()) + "], " +
>>> -
>>> "parm3=[" + (parm3 == null ? null : parm3.toString()) + "], " +
>>> -
>>> "parm4=[" + (parm4 == null ? null : parm4.toString()) + "], " +
>>> -
>>> "parm5=[" + (parm5 == null ? null : parm5.toString()) + "] )" );
>>> -    }
>>> +    public static void tracePoint(String tracePoint, String
>>> classDotMethod, Object... parms) {
>>> +        if ( parms == null ) {
>>> +            trace(Trace.INFO, tracePoint + ": " + classDotMethod + "(
>>> null )" );
>>> +        }
>>> +        else {
>>> +            trace(Trace.INFO, tracePoint + ": " + classDotMethod + "("
>>> );
>>> +            for ( int ii=0; ii<parms.length; ii++) {
>>> +                Object parm = parms[ii];
>>> +                trace(Trace.INFO, "    parm" + (ii+1) + "=[" + (parm ==
>>> null ? null : parm.toString()) + "]" );
>>> +            }
>>> +            trace(Trace.INFO, ")" );
>>> +        }
>>> +    }
>>>  }
>>> \ No newline at end of file
>>>
>>> Modified:
>>> geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Trace.java
>>> URL:
>>> http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Trace.java?rev=733149&r1=733148&r2=733149&view=diff
>>>
>>> ==============================================================================
>>> ---
>>> geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Trace.java
>>> (original)
>>> +++
>>> geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Trace.java
>>> Fri Jan  9 12:44:26 2009
>>> @@ -26,58 +26,58 @@
>>>  */
>>>  public class Trace {
>>>
>>> -       /**
>>> -        * Finest trace event.
>>> -        */
>>> -       public static byte INFO = 0;
>>> -
>>> -       /**
>>> -        * Warning trace event.
>>> -        */
>>> -       public static byte WARNING = 1;
>>> -
>>> -       /**
>>> -        * Severe trace event.
>>> -        */
>>> -       public static byte SEVERE = 2;
>>> -
>>> -       /**
>>> -        * Trace constructor comment.
>>> -        */
>>> -       private Trace() {
>>> -               super();
>>> -       }
>>> -
>>> -       /**
>>> -        * Trace the given text.
>>> -        *
>>> -        * @param level
>>> -        *            the trace level
>>> -        * @param s
>>> -        *            a message
>>> -        */
>>> -       public static void trace(byte level, String s) {
>>> -               trace(level, s, null);
>>> -       }
>>> -
>>> -       /**
>>> -        * Trace the given message and exception.
>>> -        *
>>> -        * @param level
>>> -        *            the trace level
>>> -        * @param s
>>> -        *            a message
>>> -        * @param t
>>> -        *            a throwable
>>> -        */
>>> -       public static void trace(byte level, String s, Throwable t) {
>>> -               if (!Activator.getDefault().isDebugging())
>>> -                       return;
>>> -
>>> -               System.out.println(Activator.PLUGIN_ID + ":  " + s);
>>> -               if (t != null)
>>> -                       t.printStackTrace();
>>> -       }
>>> +    /**
>>> +     * Finest trace event.
>>> +     */
>>> +    public static byte INFO = 0;
>>> +
>>> +    /**
>>> +     * Warning trace event.
>>> +     */
>>> +    public static byte WARNING = 1;
>>> +
>>> +    /**
>>> +     * Severe trace event.
>>> +     */
>>> +    public static byte SEVERE = 2;
>>> +
>>> +    /**
>>> +     * Trace constructor comment.
>>> +     */
>>> +    private Trace() {
>>> +        super();
>>> +    }
>>> +
>>> +    /**
>>> +     * Trace the given text.
>>> +     *
>>> +     * @param level
>>> +     *            the trace level
>>> +     * @param s
>>> +     *            a message
>>> +     */
>>> +    public static void trace(byte level, String s) {
>>> +        trace(level, s, null);
>>> +    }
>>> +
>>> +    /**
>>> +     * Trace the given message and exception.
>>> +     *
>>> +     * @param level
>>> +     *            the trace level
>>> +     * @param s
>>> +     *            a message
>>> +     * @param t
>>> +     *            a throwable
>>> +     */
>>> +    public static void trace(byte level, String s, Throwable t) {
>>> +        if (!Activator.getDefault().isDebugging())
>>> +            return;
>>> +
>>> +        System.out.println(Activator.PLUGIN_ID + ":  " + s);
>>> +        if (t != null)
>>> +            t.printStackTrace();
>>> +    }
>>>
>>>    /**
>>>     * Trace the given message
>>> @@ -88,38 +88,25 @@
>>>     * @param classDotMethod
>>>     *            The class name + method name (e.g., "Class.method()")
>>>     *
>>> -     * @param parm1,2,3,4,5
>>> -     *            Method parameters if the trace point is an "Entry"
>>> +     * @param parms
>>> +     *            Method parameter(s) if the trace point is an "Entry"
>>>     *            or
>>>     *            Return value if the trace point is an "Exit"
>>>     */
>>>    public static void tracePoint(String tracePoint, String
>>> classDotMethod) {
>>>        trace(Trace.INFO, tracePoint + ": " + classDotMethod + "()" );
>>>    }
>>> -    public static void tracePoint(String tracePoint, String
>>> classDotMethod, Object parm1) {
>>> -        trace(Trace.INFO, tracePoint + ": " + classDotMethod + "(
>>> parm1=[" + (parm1 == null ? null : parm1.toString()) + "] )" );
>>> -    }
>>> -
>>> -    public static void tracePoint(String tracePoint, String
>>> classDotMethod, Object parm1, Object parm2) {
>>> -        trace(Trace.INFO, tracePoint + ": " + classDotMethod + "(
>>> parm1=[" + (parm1 == null ? null : parm1.toString()) + "], " +
>>> -
>>> "parm2=[" + (parm2 == null ? null : parm2.toString()) + "] )" );
>>> -    }
>>> -    public static void tracePoint(String tracePoint, String
>>> classDotMethod, Object parm1, Object parm2, Object parm3) {
>>> -        trace(Trace.INFO, tracePoint + ": " + classDotMethod + "(
>>> parm1=[" + (parm1 == null ? null : parm1.toString()) + "], " +
>>> -
>>> "parm2=[" + (parm2 == null ? null : parm2.toString()) + "], " +
>>> -
>>> "parm3=[" + (parm3 == null ? null : parm3.toString()) + "] )" );
>>> -    }
>>> -    public static void tracePoint(String tracePoint, String
>>> classDotMethod, Object parm1, Object parm2, Object parm3, Object parm4) {
>>> -        trace(Trace.INFO, tracePoint + ": " + classDotMethod + "(
>>> parm1=[" + (parm1 == null ? null : parm1.toString()) + "], " +
>>> -
>>> "parm2=[" + (parm2 == null ? null : parm2.toString()) + "], " +
>>> -
>>> "parm3=[" + (parm3 == null ? null : parm3.toString()) + "], " +
>>> -
>>> "parm4=[" + (parm4 == null ? null : parm4.toString()) + "] )" );
>>> -    }
>>> -    public static void tracePoint(String tracePoint, String
>>> classDotMethod, Object parm1, Object parm2, Object parm3, Object parm4,
>>> Object parm5) {
>>> -        trace(Trace.INFO, tracePoint + ": " + classDotMethod + "(
>>> parm1=[" + (parm1 == null ? null : parm1.toString()) + "], " +
>>> -
>>> "parm2=[" + (parm2 == null ? null : parm2.toString()) + "], " +
>>> -
>>> "parm3=[" + (parm3 == null ? null : parm3.toString()) + "], " +
>>> -
>>> "parm4=[" + (parm4 == null ? null : parm4.toString()) + "], " +
>>> -
>>> "parm5=[" + (parm5 == null ? null : parm5.toString()) + "] )" );
>>> -    }
>>> +    public static void tracePoint(String tracePoint, String
>>> classDotMethod, Object... parms) {
>>> +        if ( parms == null ) {
>>> +            trace(Trace.INFO, tracePoint + ": " + classDotMethod + "(
>>> null )" );
>>> +        }
>>> +        else {
>>> +            trace(Trace.INFO, tracePoint + ": " + classDotMethod + "("
>>> );
>>> +            for ( int ii=0; ii<parms.length; ii++) {
>>> +                Object parm = parms[ii];
>>> +                trace(Trace.INFO, "    parm" + (ii+1) + "=[" + (parm ==
>>> null ? null : parm.toString()) + "]" );
>>> +            }
>>> +            trace(Trace.INFO, ")" );
>>> +        }
>>> +    }
>>>  }
>>> \ No newline at end of file
>>>
>>> Modified:
>>> geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/internal/Trace.java
>>> URL:
>>> http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/internal/Trace.java?rev=733149&r1=733148&r2=733149&view=diff
>>>
>>> ==============================================================================
>>> ---
>>> geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/internal/Trace.java
>>> (original)
>>> +++
>>> geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/internal/Trace.java
>>> Fri Jan  9 12:44:26 2009
>>> @@ -87,38 +87,25 @@
>>>     * @param classDotMethod
>>>     *            The class name + method name (e.g., "Class.method()")
>>>     *
>>> -     * @param parm1,2,3,4,5
>>> -     *            Method parameters if the trace point is an "Entry"
>>> +     * @param parms
>>> +     *            Method parameter(s) if the trace point is an "Entry"
>>>     *            or
>>>     *            Return value if the trace point is an "Exit"
>>>     */
>>>    public static void tracePoint(String tracePoint, String
>>> classDotMethod) {
>>>        trace(Trace.INFO, tracePoint + ": " + classDotMethod + "()" );
>>>    }
>>> -    public static void tracePoint(String tracePoint, String
>>> classDotMethod, Object parm1) {
>>> -        trace(Trace.INFO, tracePoint + ": " + classDotMethod + "(
>>> parm1=[" + (parm1 == null ? null : parm1.toString()) + "] )" );
>>> -    }
>>> -
>>> -    public static void tracePoint(String tracePoint, String
>>> classDotMethod, Object parm1, Object parm2) {
>>> -        trace(Trace.INFO, tracePoint + ": " + classDotMethod + "(
>>> parm1=[" + (parm1 == null ? null : parm1.toString()) + "], " +
>>> -
>>> "parm2=[" + (parm2 == null ? null : parm2.toString()) + "] )" );
>>> -    }
>>> -    public static void tracePoint(String tracePoint, String
>>> classDotMethod, Object parm1, Object parm2, Object parm3) {
>>> -        trace(Trace.INFO, tracePoint + ": " + classDotMethod + "(
>>> parm1=[" + (parm1 == null ? null : parm1.toString()) + "], " +
>>> -
>>> "parm2=[" + (parm2 == null ? null : parm2.toString()) + "], " +
>>> -
>>> "parm3=[" + (parm3 == null ? null : parm3.toString()) + "] )" );
>>> -    }
>>> -    public static void tracePoint(String tracePoint, String
>>> classDotMethod, Object parm1, Object parm2, Object parm3, Object parm4) {
>>> -        trace(Trace.INFO, tracePoint + ": " + classDotMethod + "(
>>> parm1=[" + (parm1 == null ? null : parm1.toString()) + "], " +
>>> -
>>> "parm2=[" + (parm2 == null ? null : parm2.toString()) + "], " +
>>> -
>>> "parm3=[" + (parm3 == null ? null : parm3.toString()) + "], " +
>>> -
>>> "parm4=[" + (parm4 == null ? null : parm4.toString()) + "] )" );
>>> -    }
>>> -    public static void tracePoint(String tracePoint, String
>>> classDotMethod, Object parm1, Object parm2, Object parm3, Object parm4,
>>> Object parm5) {
>>> -        trace(Trace.INFO, tracePoint + ": " + classDotMethod + "(
>>> parm1=[" + (parm1 == null ? null : parm1.toString()) + "], " +
>>> -
>>> "parm2=[" + (parm2 == null ? null : parm2.toString()) + "], " +
>>> -
>>> "parm3=[" + (parm3 == null ? null : parm3.toString()) + "], " +
>>> -
>>> "parm4=[" + (parm4 == null ? null : parm4.toString()) + "], " +
>>> -
>>> "parm5=[" + (parm5 == null ? null : parm5.toString()) + "] )" );
>>> -    }
>>> +    public static void tracePoint(String tracePoint, String
>>> classDotMethod, Object... parms) {
>>> +        if ( parms == null ) {
>>> +            trace(Trace.INFO, tracePoint + ": " + classDotMethod + "(
>>> null )" );
>>> +        }
>>> +        else {
>>> +            trace(Trace.INFO, tracePoint + ": " + classDotMethod + "("
>>> );
>>> +            for ( int ii=0; ii<parms.length; ii++) {
>>> +                Object parm = parms[ii];
>>> +                trace(Trace.INFO, "    parm" + (ii+1) + "=[" + (parm ==
>>> null ? null : parm.toString()) + "]" );
>>> +            }
>>> +            trace(Trace.INFO, ")" );
>>> +        }
>>> +    }
>>>  }
>>>
>>>
>>>
>>
>

Mime
View raw message