Author: j16sdiz
Date: 2008-12-30 07:26:18 +0000 (Tue, 30 Dec 2008)
New Revision: 24844

Modified:
   trunk/plugins/XMLSpider/XMLSpider.java
Log:
logging

Modified: trunk/plugins/XMLSpider/XMLSpider.java
===================================================================
--- trunk/plugins/XMLSpider/XMLSpider.java      2008-12-30 06:51:22 UTC (rev 
24843)
+++ trunk/plugins/XMLSpider/XMLSpider.java      2008-12-30 07:26:18 UTC (rev 
24844)
@@ -550,9 +550,11 @@
         */
        public class PageCallBack implements FoundURICallback{
                protected final Page page;
+               
+               protected final boolean logDEBUG = 
Logger.shouldLog(Logger.DEBUG, this); // per instance, allow changing on the fly
 
                PageCallBack(Page page) {
-                       this.page = page;
+                       this.page = page; 
                }
 
                public void foundURI(FreenetURI uri){
@@ -562,7 +564,8 @@
                public void foundURI(FreenetURI uri, boolean inline){
                        if (stopped)
                                throw new RuntimeException("plugin stopping");
-                       Logger.debug(this, "foundURI " + uri + " on " + page);
+                       if (logDEBUG)
+                               Logger.debug(this, "foundURI " + uri + " on " + 
page);
                        queueURI(uri, "Added from " + page.getURI(), false);
                }
 
@@ -571,9 +574,9 @@
                public void onText(String s, String type, URI baseURI){
                        if (stopped)
                                throw new RuntimeException("plugin stopping");
+                       if (logDEBUG)
+                               Logger.debug(this, "onText on " + page.getId() 
+ " (" + baseURI + ")");
 
-                       Logger.debug(this, "onText on " + page.getId() + " (" + 
baseURI + ")");
-
                        if ("title".equalsIgnoreCase(type) && (s != null) && 
(s.length() != 0) && (s.indexOf('\n') < 0)) {
                                /*
                                 * title of the page 
@@ -610,6 +613,9 @@
                }
 
                private void addWord(String word, int position) throws 
Exception {
+                       if (logDEBUG)
+                               Logger.debug(this, "addWord on " + page.getId() 
+ " (" + word + "," + position + ")");
+                       
                        if (word.length() < 3)
                                return;
                        Term term = getTermByWord(word, true);

_______________________________________________
cvs mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs

Reply via email to