public static void Main() { AbstractLogger loggerChain = getChainOfLoggers(); loggerChain.logMessage(AbstractLogger.INFO, "This is an information."); loggerChain.logMessage(AbstractLogger.DEBUG, "This is an debug level information."); loggerChain.logMessage(AbstractLogger.ERROR, "This is an error information."); }
protected AbstractLogger nextLogger; //next element in chain or responsibility public void setNextLogger(AbstractLogger nextLogger) { this.nextLogger = nextLogger; }