Ejemplo n.º 1
0
        static void Main(String[] args)
        {
            AbstractLogger loggerChain = getChainOfLoggers();

            loggerChain.logMessage(AbstractLogger.INFO, "This is an information.");

            loggerChain.logMessage(AbstractLogger.DEBUG,
                                   "This is a debug level information.");

            loggerChain.logMessage(AbstractLogger.ERROR,
                                   "This is an error information.");
        }
Ejemplo n.º 2
0
 public void logMessage(int level, String message)
 {
     if (this.level <= level)
     {
         write(message);
     }
     if (nextLogger != null)
     {
         nextLogger.logMessage(level, message);
     }
 }