package freenet.support; /** * A class that takes logging messages and distributes them to LoggerHooks. * It implements LoggerHook itself, so that instances can be chained (just * don't create loops). */ public class LoggerHookChain extends LoggerHook { // Best performance, least synchronization. // We will only very rarely add or remove hooks private LoggerHook[] hooks; /** * Create a logger. Threshhold set to NORMAL. */ public LoggerHookChain() { this(NORMAL); } /** * Create a logger. * @param threshold Suppress all log calls with lower priority then * this. */ public LoggerHookChain(int threshold) { super(threshold); hooks = new LoggerHook[0]; } public LoggerHookChain(String threshold) throws InvalidThresholdException { super(threshold); hooks = new LoggerHook[0]; } /** * This is the implementation of LoggerHook method, which allows * one logger receive events from another. * @implements LoggerHook.log() */ @Override public synchronized void log(Object o, Class c, String msg, Throwable e, int priority) { LoggerHook[] myHooks = hooks; for(int i=0;i 1 ? hooksLength-1 : 0]; int x=0; boolean removed = false; for(int i=0;i