[vlma-devel] commit: CommandLogger: don't log the prompt ("> "). (Adrien Grand )

git version control git at videolan.org
Sun Jan 11 04:26:59 CET 2009


vlma | branch: master | Adrien Grand <jpountz at videolan.org> | Sun Jan 11 04:25:05 2009 +0100| [d203b975e2e63fa932554f5781e0401775c009fb] | committer: Adrien Grand 

CommandLogger: don't log the prompt ("> ").

> http://git.videolan.org/gitweb.cgi/vlma.git/?a=commit;h=d203b975e2e63fa932554f5781e0401775c009fb
---

 .../java/org/videolan/vlma/order/OrderSender.java  |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/vlma-core/src/main/java/org/videolan/vlma/order/OrderSender.java b/vlma-core/src/main/java/org/videolan/vlma/order/OrderSender.java
index dd88541..107385b 100644
--- a/vlma-core/src/main/java/org/videolan/vlma/order/OrderSender.java
+++ b/vlma-core/src/main/java/org/videolan/vlma/order/OrderSender.java
@@ -103,9 +103,17 @@ public class OrderSender {
         while (conn.ready()) {
             response.append((char) conn.read());
         }
-        commandLogger.add(adapter.getServer(), command, response.toString());
+        // Remove the "> " which is due to the prompt
+        int end = response.lastIndexOf(">");
+        int responseLength = response.length();
+        if (end  < 0 || end < responseLength - 4) {
+            // No ending "> ", so keep the whole response
+            end = responseLength;
+        }
+        String responseAsString = response.substring(0, end);
+        commandLogger.add(adapter.getServer(), command, responseAsString);
         if (logger.isDebugEnabled()) {
-            logger.debug("Command result: " + response);
+            logger.debug("Command result: " + responseAsString);
         }
     }
 



More information about the vlma-devel mailing list