[slf4j-dev] slf4j i8ln

Ceki Gulcu ceki at qos.ch
Wed Aug 19 21:38:58 CEST 2009



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



More information about the slf4j-dev mailing list