summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-01-05 06:54:50 (EST)
committerEike Stepper2007-01-05 06:54:50 (EST)
commite06276de1e931bb382f12a66f7e9e4e99409d530 (patch)
tree5eae0ab5bfcc0f6b6943622291b6e5ece1560794
parentaa4f6009cfea380f34ed462323f7fcf796090ed8 (diff)
downloadcdo-e06276de1e931bb382f12a66f7e9e4e99409d530.zip
cdo-e06276de1e931bb382f12a66f7e9e4e99409d530.tar.gz
cdo-e06276de1e931bb382f12a66f7e9e4e99409d530.tar.bz2
Short context names.
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/om/trace/PrintTraceHandler.java25
1 files changed, 23 insertions, 2 deletions
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/om/trace/PrintTraceHandler.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/om/trace/PrintTraceHandler.java
index ac12b29..5886b0b 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/om/trace/PrintTraceHandler.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/om/trace/PrintTraceHandler.java
@@ -24,6 +24,8 @@ public class PrintTraceHandler implements OMTraceHandler
private PrintStream stream;
+ private boolean shortContext;
+
public PrintTraceHandler(PrintStream stream)
{
this.stream = stream;
@@ -34,10 +36,29 @@ public class PrintTraceHandler implements OMTraceHandler
this(IOUtil.OUT());
}
+ public boolean isShortContext()
+ {
+ return shortContext;
+ }
+
+ public void setShortContext(boolean shortContext)
+ {
+ this.shortContext = shortContext;
+ }
+
public void traced(Event event)
{
- stream.println(Thread.currentThread().getName()
- + " [" + event.getContext() + "] " + event.getMessage()); //$NON-NLS-1$
+ String context = event.getContext().getName();
+ if (shortContext)
+ {
+ int pos = Math.max(context.lastIndexOf('.'), context.lastIndexOf('$'));
+ if (pos != -1)
+ {
+ context = context.substring(pos + 1);
+ }
+ }
+
+ stream.println(Thread.currentThread().getName() + " [" + context + "] " + event.getMessage()); //$NON-NLS-1$
if (event.getThrowable() != null)
{
IOUtil.print(event.getThrowable(), stream);