45 lines
1.5 KiB
Java
45 lines
1.5 KiB
Java
// Copyright 2005 Nick Mathewson, Roger Dingledine
|
|
// See LICENSE file for copying information
|
|
package org.torproject.android.control.examples;
|
|
|
|
import java.io.PrintWriter;
|
|
import java.util.Iterator;
|
|
import org.torproject.android.control.EventHandler;
|
|
|
|
public class DebuggingEventHandler implements EventHandler {
|
|
|
|
private final PrintWriter out;
|
|
|
|
public DebuggingEventHandler(PrintWriter p) {
|
|
out = p;
|
|
}
|
|
|
|
public void circuitStatus(String status, String circID, String path) {
|
|
out.println("Circuit "+circID+" is now "+status+" (path="+path+")");
|
|
}
|
|
public void streamStatus(String status, String streamID, String target) {
|
|
out.println("Stream "+streamID+" is now "+status+" (target="+target+")");
|
|
}
|
|
public void orConnStatus(String status, String orName) {
|
|
out.println("OR connection to "+orName+" is now "+status);
|
|
}
|
|
public void bandwidthUsed(long read, long written) {
|
|
out.println("Bandwidth usage: "+read+" bytes read; "+
|
|
written+" bytes written.");
|
|
}
|
|
public void newDescriptors(java.util.List<String> orList) {
|
|
out.println("New descriptors for routers:");
|
|
for (Iterator<String> i = orList.iterator(); i.hasNext(); )
|
|
out.println(" "+i.next());
|
|
}
|
|
public void message(String type, String msg) {
|
|
out.println("["+type+"] "+msg.trim());
|
|
}
|
|
|
|
public void unrecognized(String type, String msg) {
|
|
out.println("unrecognized event ["+type+"] "+msg.trim());
|
|
}
|
|
|
|
}
|
|
|