Author: davsclaus
Date: Mon Jan 12 01:34:59 2009
New Revision: 733659

URL: http://svn.apache.org/viewvc?rev=733659&view=rev
Log:
CAMEL-1245: nodeLength option added to TraceFormatter

Modified:
    
activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/processor/interceptor/TraceFormatter.java

Modified: 
activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/processor/interceptor/TraceFormatter.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/processor/interceptor/TraceFormatter.java?rev=733659&r1=733658&r2=733659&view=diff
==============================================================================
--- 
activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/processor/interceptor/TraceFormatter.java
 (original)
+++ 
activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/processor/interceptor/TraceFormatter.java
 Mon Jan 12 01:34:59 2009
@@ -19,6 +19,7 @@
 import org.apache.camel.Exchange;
 import org.apache.camel.Message;
 import org.apache.camel.NoTypeConversionAvailableException;
+import org.apache.camel.model.ProcessorType;
 import org.apache.camel.converter.stream.StreamCache;
 import org.apache.camel.spi.UnitOfWork;
 import org.apache.camel.util.ObjectHelper;
@@ -28,6 +29,7 @@
  */
 public class TraceFormatter {
     private int breadCrumbLength;
+    private int nodeLength;
     private boolean showBreadCrumb = true;
     private boolean showNode = true;
     private boolean showExchangeId;
@@ -185,6 +187,14 @@
         this.showShortExchangeId = showShortExchangeId;
     }
 
+    public int getNodeLength() {
+        return nodeLength;
+    }
+
+    public void setNodeLength(int nodeLength) {
+        this.nodeLength = nodeLength;
+    }
+
     // Implementation methods
     //-------------------------------------------------------------------------
     protected Object getBreadCrumbID(Exchange exchange) {
@@ -234,9 +244,13 @@
 
     protected String getNodeMessage(TraceInterceptor interceptor) {
         String message = interceptor.getNode().getShortName() + "(" + 
interceptor.getNode().getLabel() + ")";
-        return String.format("%1$-25.25s", message);
+        if (nodeLength > 0) {
+            return String.format("%1$-" + nodeLength + "." + nodeLength + "s", 
message);
+        } else {
+            return message;
+        }
     }
-    
+
     /**
      * Returns the exchange id and node, ordered based on whether this was a 
trace of
      * an exchange coming out of or into a processing step. For example, 


Reply via email to