Пример #1
0
        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.");
        }
 public void logMessage(int level, String message)
 {
     if (this.level <= level)
     {
         Write(message);
     }
     if (nextLogger != null)
     {
         nextLogger.logMessage(level, message);
     }
 }