Pete Muir wrote:

This is valid in Java 5 and above. For example:

public interface Logger {

   public enum LogMessages {
      WRONG_PASSWORD
   }

   public static class Test {

      public void test() {
         Logger logger = new Logger() {

            public void warn(Enum<?> message) {
               // No-op, this is a mock
            }

         };
         logger.warn(LogMessages.WRONG_PASSWORD);
      }
   }

   public void warn(Enum<?> message);
}


Thank you. I now see how enums could be used but still don't see the advantage of using them.

Just to be clear, given that there is a large existing user base for slf4j, we can't modify the org.slf4j.Logger interface, except perhaps its javadoc. So any extension of Logger needs to wrap/decorate org.slf4j.Logger. See for example, XLogger [1] and XLoggerFactory [2] in the slfj-ext module.

[1] http://www.slf4j.org/xref/org/slf4j/ext/XLogger.html
[2] http://www.slf4j.org/xref/org/slf4j/ext/XLoggerFactory.html

--
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch
_______________________________________________
dev mailing list
dev@slf4j.org
http://www.slf4j.org/mailman/listinfo/dev

Reply via email to