devicemap-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From re...@apache.org
Subject svn commit: r1693333 - in /devicemap/trunk/clients/2.0/reference/src: DeviceMapClient.java Main.java
Date Wed, 29 Jul 2015 19:01:44 GMT
Author: rezan
Date: Wed Jul 29 19:01:44 2015
New Revision: 1693333

URL: http://svn.apache.org/r1693333
Log:
even better logging

Modified:
    devicemap/trunk/clients/2.0/reference/src/DeviceMapClient.java
    devicemap/trunk/clients/2.0/reference/src/Main.java

Modified: devicemap/trunk/clients/2.0/reference/src/DeviceMapClient.java
URL: http://svn.apache.org/viewvc/devicemap/trunk/clients/2.0/reference/src/DeviceMapClient.java?rev=1693333&r1=1693332&r2=1693333&view=diff
==============================================================================
--- devicemap/trunk/clients/2.0/reference/src/DeviceMapClient.java (original)
+++ devicemap/trunk/clients/2.0/reference/src/DeviceMapClient.java Wed Jul 29 19:01:44 2015
@@ -70,7 +70,7 @@ public class DeviceMapClient {
       throw new Exception("DomainVersions do not match: " + domainVersion + " != " + patterns.getDomainVersion());
     }
 
-    Main.log("  Loading pattern domain: " + patterns.getDomain() + ", version: " +
+    Main.log("Loading pattern domain: " + patterns.getDomain() + ", version: " +
         patterns.getDomainVersion() + (patch ? ", patch" : ""), 1);
 
     if(get(patterns.getJsonNode(), "inputParser").isObject()) {
@@ -86,11 +86,11 @@ public class DeviceMapClient {
 
           transformers.add(getTransformer(transformer));
 
-          Main.log("  Found transformer: " + transformer.get("type"), 2);
+          Main.log("Found transformer: " + transformer.get("type"), 2);
         }
       }
 
-      Main.log("  Found " + transformers.size() + " transformer(s)", 1);
+      Main.log("Found " + transformers.size() + " transformer(s)", 1);
 
       if(get(inputParser, "tokenSeperators").isArray()) {
         if(patch) {
@@ -106,16 +106,16 @@ public class DeviceMapClient {
 
           tokenSeperators.add(tokenSeperator.asText().getBytes());
 
-          Main.log("  Found tokenSeperator: '" + tokenSeperator.asText() + "'", 2);
+          Main.log("Found tokenSeperator: '" + tokenSeperator.asText() + "'", 2);
         }
       }
 
-      Main.log("  Found " + tokenSeperators.size() + " tokenSeperator(s)", 1);
+      Main.log("Found " + tokenSeperators.size() + " tokenSeperator(s)", 1);
 
       if(get(inputParser, "ngramConcatSize").asInt(0) > 0) {
         ngramConcatSize = inputParser.get("ngramConcatSize").asInt(0);
 
-        Main.log("  Found ngramConcatSize: " + ngramConcatSize, 2);
+        Main.log("Found ngramConcatSize: " + ngramConcatSize, 2);
       }
     }
 
@@ -125,7 +125,7 @@ public class DeviceMapClient {
       if(get(patternSet, "defaultId").isTextual()) {
         defaultId = patternSet.get("defaultId").asText();
 
-        Main.log("  Found defaultId: " + defaultId, 2);
+        Main.log("Found defaultId: " + defaultId, 2);
       }
 
       int patternCount = 0;
@@ -140,13 +140,13 @@ public class DeviceMapClient {
 
           String patternId = pattern.get("patternId").asText();
 
-          Main.log("  patternId: " + patternId, 3);
+          Main.log("patternId: " + patternId, 3);
 
           patternCount++;
         }
       }
 
-      Main.log("  Found " + patternCount + " pattern(s)", 1);
+      Main.log("Found " + patternCount + " pattern(s)", 1);
     }
   }
 
@@ -163,7 +163,7 @@ public class DeviceMapClient {
       throw new Exception("DomainVersions do not match: " + domainVersion + " != " + attributes.getDomainVersion());
     }
 
-    Main.log("  Loading attributes: " + attributes.getDomain() + ", version: " + attributes.getDomainVersion(),
1);
+    Main.log("Loading attributes: " + attributes.getDomain() + ", version: " + attributes.getDomainVersion(),
1);
 
     int attributeCount = 0;
 
@@ -177,7 +177,7 @@ public class DeviceMapClient {
 
           String patternId = attribute.get("patternId").asText();
 
-          Main.log("  Attribute patternId: " + patternId, 3);
+          Main.log("Attribute patternId: " + patternId, 3);
 
           if(get(attribute, "attributes").isObject()) {
             for(Iterator<String> j = attribute.get("attributes").getFieldNames(); j.hasNext();)
{
@@ -208,7 +208,7 @@ public class DeviceMapClient {
         }
       }
 
-    Main.log("  Found " + attributeCount + " attributes(s)", 1);
+    Main.log("Found " + attributeCount + " attributes(s)", 1);
   }
 
   public static JsonNode get(JsonNode node, String name) throws Exception {
@@ -246,7 +246,7 @@ public class DeviceMapClient {
       text = "";
     }
 
-    Main.log("  Classify: '" + text + "'", 2);
+    Main.log("Classify: '" + text + "'", 2);
 
     String transformed = text;
 
@@ -254,7 +254,7 @@ public class DeviceMapClient {
       transformed = transformer.transform(transformed);
     }
 
-    Main.log("  Transformed: '" + transformed + "'", 2);
+    Main.log("Transformed: '" + transformed + "'", 3);
 
     //tokenization using bytes
     List<String> tokens = new ArrayList<String>();
@@ -294,7 +294,7 @@ public class DeviceMapClient {
       tokens.add(new String(dest, 0, destPos));
     }
 
-    Main.log("  Tokens: " + tokens, 2);
+    Main.log("Tokens: " + tokens, 3);
 
     List<String> ngrams = new ArrayList<String>();
 
@@ -313,7 +313,7 @@ public class DeviceMapClient {
       ngramParts.clear();
     }
 
-    Main.log("  Ngrams: " + ngrams, 2);
+    Main.log("Ngrams: " + ngrams, 3);
     
     return "";
   }

Modified: devicemap/trunk/clients/2.0/reference/src/Main.java
URL: http://svn.apache.org/viewvc/devicemap/trunk/clients/2.0/reference/src/Main.java?rev=1693333&r1=1693332&r2=1693333&view=diff
==============================================================================
--- devicemap/trunk/clients/2.0/reference/src/Main.java (original)
+++ devicemap/trunk/clients/2.0/reference/src/Main.java Wed Jul 29 19:01:44 2015
@@ -119,6 +119,10 @@ public class Main {
 
   public static void log(String s, int level) {
     if(level <= verbose) {
+      for(int i = 0; i < level; i++) {
+        System.out.print("  ");
+      }
+      
       System.out.println(s);
     }
   }
@@ -136,7 +140,7 @@ public class Main {
       throw new Exception("DomainVersions do not match: " + client.getDomainVersion() + "
!= " + tests.getDomainVersion());
     }
 
-    log("  Loading test: " + tests.getDomain() + ", version: " + tests.getDomainVersion(),
1);
+    log("Loading test: " + tests.getDomain() + ", version: " + tests.getDomainVersion(),
1);
 
     int testCount = 0;
     int passCount = 0;



Mime
View raw message