Author: toad
Date: 2007-04-20 15:36:40 +0000 (Fri, 20 Apr 2007)
New Revision: 12814

Modified:
   trunk/freenet/src/freenet/node/GlobalProbe.java
   trunk/freenet/src/freenet/node/TextModeClientInterface.java
   trunk/freenet/src/freenet/support/StringArray.java
Log:
logging

Modified: trunk/freenet/src/freenet/node/GlobalProbe.java
===================================================================
--- trunk/freenet/src/freenet/node/GlobalProbe.java     2007-04-20 15:25:20 UTC 
(rev 12813)
+++ trunk/freenet/src/freenet/node/GlobalProbe.java     2007-04-20 15:36:40 UTC 
(rev 12814)
@@ -4,6 +4,7 @@
 package freenet.node;

 import freenet.support.Logger;
+import freenet.support.StringArray;

 public class GlobalProbe implements Runnable {

@@ -30,7 +31,7 @@
                        }

                        public void onTrace(long uid, double target, double 
nearest, double best, short htl, short counter, double location, long nodeUID, 
double[] peerLocs, long[] peerUIDs) {
-                               String msg = "Probe trace: UID="+uid+" 
target="+target+" nearest="+nearest+" best="+best+" htl="+htl+" 
counter="+counter+" location="+location+"node UID="+nodeUID+" peer 
locs="+peerLocs+" peer UIDs="+peerUIDs;
+                               String msg = "Probe trace: UID="+uid+" 
target="+target+" nearest="+nearest+" best="+best+" htl="+htl+" 
counter="+counter+" location="+location+"node UID="+nodeUID+" peer 
locs="+StringArray.toString(peerLocs)+" peer 
UIDs="+StringArray.toString(peerUIDs);
                                Logger.error(this, msg);
                        }
        };

Modified: trunk/freenet/src/freenet/node/TextModeClientInterface.java
===================================================================
--- trunk/freenet/src/freenet/node/TextModeClientInterface.java 2007-04-20 
15:25:20 UTC (rev 12813)
+++ trunk/freenet/src/freenet/node/TextModeClientInterface.java 2007-04-20 
15:36:40 UTC (rev 12814)
@@ -44,6 +44,7 @@
 import freenet.support.OOMHandler;
 import freenet.support.SimpleFieldSet;
 import freenet.support.SizeUtil;
+import freenet.support.StringArray;
 import freenet.support.api.Bucket;
 import freenet.support.io.ArrayBucket;
 import freenet.support.io.ArrayBucketFactory;
@@ -830,7 +831,7 @@
                                }

                                public void onTrace(long uid, double target, 
double nearest, double best, short htl, short counter, double location, long 
nodeUID, double[] peerLocs, long[] peerUIDs) {
-                                       String msg = "Probe trace: UID="+uid+" 
target="+target+" nearest="+nearest+" best="+best+" htl="+htl+" 
counter="+counter+" location="+location+"node UID="+nodeUID+" peer 
locs="+peerLocs+" peer UIDs="+peerUIDs;
+                                       String msg = "Probe trace: UID="+uid+" 
target="+target+" nearest="+nearest+" best="+best+" htl="+htl+" 
counter="+counter+" location="+location+"node UID="+nodeUID+" peer 
locs="+StringArray.toString(peerLocs)+" peer 
UIDs="+StringArray.toString(peerUIDs);
                                        System.err.println(msg);
                                }
                };

Modified: trunk/freenet/src/freenet/support/StringArray.java
===================================================================
--- trunk/freenet/src/freenet/support/StringArray.java  2007-04-20 15:25:20 UTC 
(rev 12813)
+++ trunk/freenet/src/freenet/support/StringArray.java  2007-04-20 15:36:40 UTC 
(rev 12814)
@@ -55,4 +55,33 @@
                }else
                        return null;
        }
+
+       public static String[] toArray(double[] array) {
+               if((array != null) && (array.length > 0)){
+                       String[] result = new String[array.length];
+                       for(int i=0; i<array.length; i++)
+                               result[i] = Double.toString(array[i]);
+                       return result;
+               }else
+                       return null;
+       }
+       
+       public static String toString(double[] array) {
+               return toString(toArray(array));
+       }
+       
+       public static String[] toArray(long[] array) {
+               if((array != null) && (array.length > 0)){
+                       String[] result = new String[array.length];
+                       for(int i=0; i<array.length; i++)
+                               result[i] = Long.toString(array[i]);
+                       return result;
+               }else
+                       return null;
+       }
+       
+       public static String toString(long[] array) {
+               return toString(toArray(array));
+       }
+       
 }


Reply via email to