aboutsummaryrefslogtreecommitdiffstats
path: root/weaver
diff options
context:
space:
mode:
authormwebster <mwebster>2006-08-25 11:31:30 +0000
committermwebster <mwebster>2006-08-25 11:31:30 +0000
commit5787d0e82f32648f30f4677c13aef68d4615e300 (patch)
tree1bf6a9847346ccba76aa09cb913ebf267e1e4d2a /weaver
parent91c20abd138e0cf548e1cebc90fabad3586abc09 (diff)
downloadaspectj-5787d0e82f32648f30f4677c13aef68d4615e300.tar.gz
aspectj-5787d0e82f32648f30f4677c13aef68d4615e300.zip
Bug 150487 "Tracing and Logging Framework" (Trace.event())
Diffstat (limited to 'weaver')
-rw-r--r--weaver/src/org/aspectj/weaver/tools/AbstractTrace.java12
-rw-r--r--weaver/src/org/aspectj/weaver/tools/CommonsTrace.java12
-rw-r--r--weaver/src/org/aspectj/weaver/tools/DefaultTrace.java13
-rw-r--r--weaver/src/org/aspectj/weaver/tools/Trace.java2
-rw-r--r--weaver/testsrc/org/aspectj/weaver/AbstractTraceTest.java12
5 files changed, 43 insertions, 8 deletions
diff --git a/weaver/src/org/aspectj/weaver/tools/AbstractTrace.java b/weaver/src/org/aspectj/weaver/tools/AbstractTrace.java
index 893650b1f..23d2aba39 100644
--- a/weaver/src/org/aspectj/weaver/tools/AbstractTrace.java
+++ b/weaver/src/org/aspectj/weaver/tools/AbstractTrace.java
@@ -34,14 +34,6 @@ public abstract class AbstractTrace implements Trace {
public abstract void exit(String methodName, Throwable th);
- public void event(String methodName) {
- throw new UnsupportedOperationException("event");
- }
-
- public void event(String methodName, Object thiz, Object[] args) {
- throw new UnsupportedOperationException("event");
- }
-
/*
* Convenience methods
*/
@@ -61,6 +53,10 @@ public abstract class AbstractTrace implements Trace {
exit(methodName,new Boolean(b));
}
+ public void event (String methodName, Object thiz, Object arg) {
+ event(methodName,thiz,new Object[] { arg });
+ }
+
public void warn(String message) {
warn(message,null);
}
diff --git a/weaver/src/org/aspectj/weaver/tools/CommonsTrace.java b/weaver/src/org/aspectj/weaver/tools/CommonsTrace.java
index 75afbaf2d..25562c050 100644
--- a/weaver/src/org/aspectj/weaver/tools/CommonsTrace.java
+++ b/weaver/src/org/aspectj/weaver/tools/CommonsTrace.java
@@ -54,6 +54,18 @@ public class CommonsTrace extends AbstractTrace {
}
}
+ public void event(String methodName, Object thiz, Object[] args) {
+ if (log.isDebugEnabled()) {
+ log.debug(formatMessage("-", className, methodName, thiz, args));
+ }
+ }
+
+ public void event(String methodName) {
+ if (log.isDebugEnabled()) {
+ log.debug(formatMessage("-", className, methodName, null, null));
+ }
+ }
+
public boolean isTraceEnabled () {
return log.isDebugEnabled();
}
diff --git a/weaver/src/org/aspectj/weaver/tools/DefaultTrace.java b/weaver/src/org/aspectj/weaver/tools/DefaultTrace.java
index ddb03dbb5..788bc95eb 100644
--- a/weaver/src/org/aspectj/weaver/tools/DefaultTrace.java
+++ b/weaver/src/org/aspectj/weaver/tools/DefaultTrace.java
@@ -55,6 +55,19 @@ public class DefaultTrace extends AbstractTrace {
println(formatMessage("<",tracedClass.getName(),methodName,th, null));
}
}
+
+ public void event(String methodName, Object thiz, Object[] args) {
+ if (traceEnabled) {
+ println(formatMessage("-",tracedClass.getName(),methodName,thiz, args));
+ }
+ }
+
+ public void event(String methodName) {
+ if (traceEnabled) {
+ println(formatMessage("-",tracedClass.getName(),methodName,null,null));
+ }
+ }
+
public void debug (String message) {
println(formatMessage("?",message,null));
}
diff --git a/weaver/src/org/aspectj/weaver/tools/Trace.java b/weaver/src/org/aspectj/weaver/tools/Trace.java
index ace5f4971..6c4ac3873 100644
--- a/weaver/src/org/aspectj/weaver/tools/Trace.java
+++ b/weaver/src/org/aspectj/weaver/tools/Trace.java
@@ -51,6 +51,8 @@ public interface Trace {
public void enter (String methodName, Object thiz, boolean z);
public void exit (String methodName, boolean b);
+
+ public void event (String methodName, Object thiz, Object arg);
public boolean isTraceEnabled ();
diff --git a/weaver/testsrc/org/aspectj/weaver/AbstractTraceTest.java b/weaver/testsrc/org/aspectj/weaver/AbstractTraceTest.java
index b28323a91..8f895a81b 100644
--- a/weaver/testsrc/org/aspectj/weaver/AbstractTraceTest.java
+++ b/weaver/testsrc/org/aspectj/weaver/AbstractTraceTest.java
@@ -73,6 +73,18 @@ public abstract class AbstractTraceTest extends TestCase {
trace.exit("testExit");
}
+ public void testEvent() {
+ trace.event("testEvent");
+ }
+
+ public void testEventWithThisAndArgs() {
+ trace.event("testEventWithThisAndArgs",this,new Object[] { "arg1", "arg2" });
+ }
+
+ public void testEventWithThisAndArg() {
+ trace.event("testEventWithThisAndArg",this,"arg1");
+ }
+
public void testDebug() {
trace.debug("debug");
}