added ignore to Logger interface
git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@2104 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
parent
c018491a36
commit
608eec242e
|
@ -114,6 +114,14 @@ public class JavaUtilLog implements Logger
|
|||
return new JavaUtilLog(name);
|
||||
}
|
||||
|
||||
public void ignore(Throwable ignored)
|
||||
{
|
||||
if (Log.isIgnored())
|
||||
{
|
||||
warn(Log.IGNORED, ignored);
|
||||
}
|
||||
}
|
||||
|
||||
private String format(String msg, Object... args)
|
||||
{
|
||||
msg = String.valueOf(msg); // Avoids NPE
|
||||
|
|
|
@ -116,6 +116,10 @@ public class Log
|
|||
return __log;
|
||||
}
|
||||
|
||||
static boolean isIgnored()
|
||||
{
|
||||
return __ignored;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Log to parent Logger.
|
||||
|
|
|
@ -99,4 +99,10 @@ public interface Logger
|
|||
* @return a logger with the given name
|
||||
*/
|
||||
public Logger getLogger(String name);
|
||||
|
||||
/**
|
||||
* Ignore an exception.
|
||||
* <p>This should be used rather than an empty catch block.
|
||||
*/
|
||||
public void ignore(Throwable ignored);
|
||||
}
|
||||
|
|
|
@ -181,6 +181,14 @@ public class LoggerLog implements Logger
|
|||
}
|
||||
}
|
||||
|
||||
public void ignore(Throwable ignored)
|
||||
{
|
||||
if (Log.isIgnored())
|
||||
{
|
||||
warn(Log.IGNORED, ignored);
|
||||
}
|
||||
}
|
||||
|
||||
public Logger getLogger(String name)
|
||||
{
|
||||
try
|
||||
|
|
|
@ -95,6 +95,14 @@ public class Slf4jLog implements Logger
|
|||
return new Slf4jLog(name);
|
||||
}
|
||||
|
||||
public void ignore(Throwable ignored)
|
||||
{
|
||||
if (Log.isIgnored())
|
||||
{
|
||||
warn(Log.IGNORED, ignored);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
|
|
|
@ -325,4 +325,12 @@ public class StdErrLog implements Logger
|
|||
{
|
||||
return "StdErrLog:" + _name + ":DEBUG=" + _debug;
|
||||
}
|
||||
|
||||
public void ignore(Throwable ignored)
|
||||
{
|
||||
if (Log.isIgnored())
|
||||
{
|
||||
warn(Log.IGNORED, ignored);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue