We don't want to expose the type parameter just used to pass log level
constants up from the logger impl and back down, so we'll just use Object and do the casting manually. git-svn-id: https://samskivert.googlecode.com/svn/trunk@2905 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -105,7 +105,7 @@ public class JDK14Logger implements Logger.Factory
|
||||
return new String[] { null, null };
|
||||
}
|
||||
|
||||
protected static class Impl extends Logger<Level>
|
||||
protected static class Impl extends Logger
|
||||
{
|
||||
public Impl (java.util.logging.Logger impl)
|
||||
{
|
||||
@@ -113,21 +113,21 @@ public class JDK14Logger implements Logger.Factory
|
||||
}
|
||||
|
||||
@Override // from Logger
|
||||
protected List<Level> getLevels ()
|
||||
protected List<?> getLevels ()
|
||||
{
|
||||
return LEVELS;
|
||||
}
|
||||
|
||||
@Override // from Logger
|
||||
protected boolean shouldLog (Level level)
|
||||
protected boolean shouldLog (Object level)
|
||||
{
|
||||
return _impl.isLoggable(level);
|
||||
return _impl.isLoggable((Level)level);
|
||||
}
|
||||
|
||||
@Override // from Logger
|
||||
protected void doLog (Level level, String formatted, Throwable throwable)
|
||||
protected void doLog (Object level, String formatted, Throwable throwable)
|
||||
{
|
||||
_impl.log(level, formatted, throwable);
|
||||
_impl.log((Level)level, formatted, throwable);
|
||||
}
|
||||
|
||||
protected java.util.logging.Logger _impl;
|
||||
|
||||
@@ -48,7 +48,7 @@ public class Log4JLogger implements Logger.Factory
|
||||
return getLogger(clazz.getName());
|
||||
}
|
||||
|
||||
protected static class Impl extends Logger<Level>
|
||||
protected static class Impl extends Logger
|
||||
{
|
||||
public Impl (org.apache.log4j.Logger impl)
|
||||
{
|
||||
@@ -56,21 +56,21 @@ public class Log4JLogger implements Logger.Factory
|
||||
}
|
||||
|
||||
@Override // from Logger
|
||||
protected List<Level> getLevels ()
|
||||
protected List<?> getLevels ()
|
||||
{
|
||||
return LEVELS;
|
||||
}
|
||||
|
||||
@Override // from Logger
|
||||
protected boolean shouldLog (Level level)
|
||||
protected boolean shouldLog (Object level)
|
||||
{
|
||||
return _impl.isEnabledFor(level);
|
||||
return _impl.isEnabledFor((Level)level);
|
||||
}
|
||||
|
||||
@Override // from Logger
|
||||
protected void doLog (Level level, String formatted, Throwable throwable)
|
||||
protected void doLog (Object level, String formatted, Throwable throwable)
|
||||
{
|
||||
_impl.log(_self, level, formatted, throwable);
|
||||
_impl.log(_self, (Level)level, formatted, throwable);
|
||||
}
|
||||
|
||||
protected final org.apache.log4j.Logger _impl;
|
||||
|
||||
@@ -39,7 +39,7 @@ import java.util.List;
|
||||
* <p> The final parameter can optionally be a Throwable, which will be supplied to the underlying
|
||||
* log system as an exception to accompany the log message.
|
||||
*/
|
||||
public abstract class Logger<L>
|
||||
public abstract class Logger
|
||||
{
|
||||
/**
|
||||
* Used to create logger instances. This is only public so that the log factory can be
|
||||
@@ -136,7 +136,7 @@ public abstract class Logger<L>
|
||||
|
||||
protected void doLog (int levIdx, Object message, Object[] args)
|
||||
{
|
||||
L level = getLevels().get(levIdx);
|
||||
Object level = getLevels().get(levIdx);
|
||||
if (!shouldLog(level)) {
|
||||
return;
|
||||
}
|
||||
@@ -175,14 +175,14 @@ public abstract class Logger<L>
|
||||
|
||||
/** Returns the logger implementation specific level constants in a specific order: debug,
|
||||
* info, warn, error. */
|
||||
protected abstract List<L> getLevels ();
|
||||
protected abstract List<?> getLevels ();
|
||||
|
||||
/** Returns true if a log message at the specified level should be logged. */
|
||||
protected abstract boolean shouldLog (L level);
|
||||
protected abstract boolean shouldLog (Object level);
|
||||
|
||||
/** Performs the actual logging of a message at the specified level.
|
||||
* @param throwable an exception that accompanies this message or null. */
|
||||
protected abstract void doLog (L level, String formatted, Throwable throwable);
|
||||
protected abstract void doLog (Object level, String formatted, Throwable throwable);
|
||||
|
||||
/**
|
||||
* Called at static initialization time. Selects and initializes our logging backend.
|
||||
|
||||
Reference in New Issue
Block a user