geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r410174 - /geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/commandline/LoggingVisitor.java
Date Tue, 30 May 2006 02:40:22 GMT
Author: jdillon
Date: Mon May 29 19:40:22 2006
New Revision: 410174

URL: http://svn.apache.org/viewvc?rev=410174&view=rev
Log:
Simplify node logging impl (again)

Modified:
    geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/commandline/LoggingVisitor.java

Modified: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/commandline/LoggingVisitor.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/commandline/LoggingVisitor.java?rev=410174&r1=410173&r2=410174&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/commandline/LoggingVisitor.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/commandline/LoggingVisitor.java
Mon May 29 19:40:22 2006
@@ -23,7 +23,6 @@
 import org.apache.geronimo.gshell.commandline.parser.ASTQuotedString;
 import org.apache.geronimo.gshell.commandline.parser.ASTOpaqueString;
 import org.apache.geronimo.gshell.commandline.parser.ASTPlainString;
-import org.apache.geronimo.gshell.commandline.parser.Node;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -52,9 +51,9 @@
         this.log = log;
     }
 
-    private void log(final Class type, final Node node, final Object data) {
+    private Object log(final Class type, final SimpleNode node, Object data) {
         if (!log.isDebugEnabled()) {
-            return;
+            return data;
         }
 
         StringBuffer buff = new StringBuffer();
@@ -69,13 +68,11 @@
         }
 
         //
-        // TODO: May wany to expose DEBUG/INFO switch
+        // TODO: Expose DEBUG/INFO switch?
         //
 
         log.debug(buff);
-    }
 
-    private Object logChildren(final SimpleNode node, Object data) {
         indent++;
         data = node.childrenAccept(this, data);
         indent--;
@@ -84,32 +81,26 @@
     }
 
     public Object visit(final SimpleNode node, Object data) {
-        log(SimpleNode.class, node, data);
-        return logChildren(node, data);
+        return log(SimpleNode.class, node, data);
     }
 
     public Object visit(final ASTCommandLine node, Object data) {
-        log(ASTCommandLine.class, node, data);
-        return logChildren(node, data);
+        return log(ASTCommandLine.class, node, data);
     }
 
     public Object visit(final ASTExpression node, Object data) {
-        log(ASTExpression.class, node, data);
-        return logChildren(node, data);
+        return log(ASTExpression.class, node, data);
     }
 
     public Object visit(final ASTQuotedString node, Object data) {
-        log(ASTQuotedString.class, node, data);
-        return logChildren(node, data);
+        return log(ASTQuotedString.class, node, data);
     }
 
     public Object visit(final ASTOpaqueString node, Object data) {
-        log(ASTOpaqueString.class, node, data);
-        return logChildren(node, data);
+        return log(ASTOpaqueString.class, node, data);
     }
 
     public Object visit(final ASTPlainString node, Object data) {
-        log(ASTPlainString.class, node, data);
-        return logChildren(node, data);
+        return log(ASTPlainString.class, node, data);
     }
 }



Mime
View raw message