FileDocCategorySizeDatePackage
DHTLog.javaAPI DocAzureus 3.0.3.45062Thu Feb 09 19:43:12 GMT 2006com.aelitis.azureus.core.dht.impl

DHTLog

public class DHTLog extends Object
author
parg

Fields Summary
public static final boolean
GLOBAL_BLOOM_TRACE
public static final boolean
LOCAL_BLOOM_TRACE
public static final boolean
CONTACT_VERIFY_TRACE
public static final boolean
TRACE_VERSIONS
public static boolean
logging_on
private static com.aelitis.azureus.core.dht.DHTLogger
logger
Constructors Summary
Methods Summary
public static java.lang.StringgetFullString(byte[] b)

		return( ByteFormatter.nicePrint(b));
	
public static java.lang.StringgetString(com.aelitis.azureus.core.dht.transport.DHTTransportContact contact)

		if ( logging_on ){
			return( contact.getString());
		}else{
			return( "" );
		}
	
public static java.lang.StringgetString(java.util.List l)

		if ( logging_on ){
			String	res = "{";
			
			for (int i=0;i<l.size();i++){
				
				res += (i==0?"":",") + getString((DHTTransportContact)l.get(i));
			}
			
			return( res + "}" );
		}else{
			return( "" );
		}
	
public static java.lang.StringgetString(java.util.Set s)

		if ( logging_on ){
			String	res = "{";
			
			Iterator it = s.iterator();
			
			while( it.hasNext()){
				
				res += (res.length()==1?"":",") + getString((DHTTransportContact)it.next());
			}
			
			return( res + "}" );
		}else{
			return( "" );
		}
	
public static java.lang.StringgetString(java.util.Map s)

		if ( logging_on ){
			String	res = "{";
			
			Iterator it = s.keySet().iterator();
			
			while( it.hasNext()){
				
				res += (res.length()==1?"":",") + getString((HashWrapper)it.next());
			}
			
			return( res + "}" );	
		}else{
			return( "" );
		}
	
public static java.lang.StringgetString(com.aelitis.azureus.core.dht.transport.DHTTransportValue[] values)

		if ( logging_on ){
			
			if ( values == null ){
				
				return( "<null>");
			}
			
			String	res = "";
			
			for (int i=0;i<values.length;i++){
				
				res += (i==0?"":",") + getString( values[i] );
			}
			return( res );
		}else{
			return( "" );
		}
	
public static java.lang.StringgetString(com.aelitis.azureus.core.dht.transport.DHTTransportValue value)

		if ( logging_on ){
			
			if ( value == null ){
				
				return( "<null>");
			}
			
			return( getString(value.getValue()) + "<" + (value.isLocal()?"local":"remote" ) + ">" );
		}else{
			return( "" );
		}
	
public static java.lang.StringgetString(byte[] b)

		if ( logging_on ){
			
			return( getString2(b));
	
			
		}else{
			
			return( "" );
		}
	
public static java.lang.StringgetString(org.gudy.azureus2.core3.util.HashWrapper w)

		if ( logging_on ){
			
			return( getString( w.getHash()));
			
		}else{
			return( "" );
		}
	
public static java.lang.StringgetString(com.aelitis.azureus.core.dht.transport.DHTTransportContact[] contacts)

		if ( logging_on ){
			
			String	res = "{";
			
			for (int i=0;i<contacts.length;i++){
				
				res += (i==0?"":",") + getString(contacts[i].getID());
			}
			
			return( res + "}" );
		}else{
			return( "" );
		}
	
public static java.lang.StringgetString2(byte[] b)

		String res = ByteFormatter.nicePrint(b);
		
		if ( res.length() > 8 ){
			
			res = res.substring(0,8)+"...";
		}
		
		return( res );
	
public static booleanisOn()

		return( logging_on );
	
public static voidlog(java.lang.String str)

		if ( logging_on ){
						
			if ( logger != null ){
				
				logger.log( str );
				
			}else{
				
				System.out.println( str );
			}
		}
	
public static voidsetLogger(com.aelitis.azureus.core.dht.DHTLogger l)

		logger	= l;
	
protected static voidsetLogging(boolean on)

	
	  
	
			 
	
		logging_on 	= on;