websphinx
Class EventLog

java.lang.Object
  |
  +--websphinx.EventLog
All Implemented Interfaces:
CrawlListener, LinkListener

public class EventLog
extends java.lang.Object
implements CrawlListener, LinkListener

Crawling monitor that writes messages to standard output or a file. Acts as both a CrawlListener (monitoring start and end of the crawl) and as a LinkListener (monitoring page retrieval).


Constructor Summary
EventLog()
          Make a EventLog that writes to standard output.
EventLog(java.io.OutputStream out)
          Make a EventLog that writes to a stream.
EventLog(java.lang.String filename)
          Make a EventLog that writes to a file.
 
Method Summary
 void cleared(CrawlEvent event)
          Notify that the crawler's state was cleared.
 void crawled(LinkEvent event)
          Notify that a link event occured.
 boolean getOnlyNetworkEvents()
          Test whether logger prints only network-related LinkEvents.
static EventLog monitor(Crawler crawler)
          Create a EventLog that prints to standard error and attach it to a crawler.
 void paused(CrawlEvent event)
          Notify that the crawler paused.
 void setOnlyNetworkEvents(boolean flag)
          Set whether logger prints only network-related LinkEvents.
 void started(CrawlEvent event)
          Notify that the crawler started.
 void stopped(CrawlEvent event)
          Notify that the crawler has stopped.
 void timedOut(CrawlEvent event)
          Notify that the crawler timed out.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventLog

public EventLog()
Make a EventLog that writes to standard output.


EventLog

public EventLog(java.io.OutputStream out)
Make a EventLog that writes to a stream.


EventLog

public EventLog(java.lang.String filename)
         throws java.io.IOException
Make a EventLog that writes to a file. The file is overwritten.

Parameters:
filename - File to which crawling event messages are written
Method Detail

setOnlyNetworkEvents

public void setOnlyNetworkEvents(boolean flag)
Set whether logger prints only network-related LinkEvents. If true, then the logger only prints LinkEvents where LinkEvent.isNetworkEvent() returns true. If false, then the logger prints all LinkEvents. Default is true.

Parameters:
flag - true iff only network LinkEvents should be logged

getOnlyNetworkEvents

public boolean getOnlyNetworkEvents()
Test whether logger prints only network-related LinkEvents. If true, then the logger only prints LinkEvents where LinkEvent.isNetworkEvent() returns true. If false, then the logger prints all LinkEvents. Default is true.

Returns:
true iff only network LinkEvents are logged

started

public void started(CrawlEvent event)
Notify that the crawler started.

Specified by:
started in interface CrawlListener

stopped

public void stopped(CrawlEvent event)
Notify that the crawler has stopped.

Specified by:
stopped in interface CrawlListener

cleared

public void cleared(CrawlEvent event)
Notify that the crawler's state was cleared.

Specified by:
cleared in interface CrawlListener

timedOut

public void timedOut(CrawlEvent event)
Notify that the crawler timed out.

Specified by:
timedOut in interface CrawlListener

paused

public void paused(CrawlEvent event)
Notify that the crawler paused.

Specified by:
paused in interface CrawlListener

crawled

public void crawled(LinkEvent event)
Notify that a link event occured.

Specified by:
crawled in interface LinkListener

monitor

public static EventLog monitor(Crawler crawler)
Create a EventLog that prints to standard error and attach it to a crawler. This is a convenience method.

Parameters:
crawler - Crawler to be monitored