Whitespace, javadocs and @Overrides for the Logger classes
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1755192 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a1f6d9c832
commit
f8bc502028
@ -27,19 +27,13 @@ import org.apache.commons.logging.LogFactory;
|
||||
* developers to write log calls, while simultaneously making those
|
||||
* calls as cheap as possible by performing lazy evaluation of the log
|
||||
* message.<p>
|
||||
*
|
||||
* @author Marc Johnson (mjohnson at apache dot org)
|
||||
* @author Glen Stampoultzis (glens at apache.org)
|
||||
* @author Nicola Ken Barozzi (nicolaken at apache.org)
|
||||
*/
|
||||
|
||||
public class CommonsLogger extends POILogger
|
||||
{
|
||||
|
||||
private static LogFactory _creator = LogFactory.getFactory();
|
||||
private Log log = null;
|
||||
|
||||
|
||||
@Override
|
||||
public void initialize(final String cat)
|
||||
{
|
||||
this.log = _creator.getInstance(cat);
|
||||
@ -51,6 +45,7 @@ public class CommonsLogger extends POILogger
|
||||
* @param level One of DEBUG, INFO, WARN, ERROR, FATAL
|
||||
* @param obj1 The object to log.
|
||||
*/
|
||||
@Override
|
||||
public void log(final int level, final Object obj1)
|
||||
{
|
||||
if(level==FATAL)
|
||||
@ -104,6 +99,7 @@ public class CommonsLogger extends POILogger
|
||||
* @param obj1 The object to log. This is converted to a string.
|
||||
* @param exception An exception to be logged
|
||||
*/
|
||||
@Override
|
||||
public void log(final int level, final Object obj1,
|
||||
final Throwable exception)
|
||||
{
|
||||
@ -175,7 +171,7 @@ public class CommonsLogger extends POILogger
|
||||
*
|
||||
* @param level One of DEBUG, INFO, WARN, ERROR, FATAL
|
||||
*/
|
||||
|
||||
@Override
|
||||
public boolean check(final int level)
|
||||
{
|
||||
if(level==FATAL)
|
||||
|
@ -22,14 +22,10 @@ package org.apache.poi.util;
|
||||
* developers to write log calls, while simultaneously making those
|
||||
* calls as cheap as possible by performing lazy evaluation of the log
|
||||
* message.<p>
|
||||
*
|
||||
* @author Marc Johnson (mjohnson at apache dot org)
|
||||
* @author Glen Stampoultzis (glens at apache.org)
|
||||
* @author Nicola Ken Barozzi (nicolaken at apache.org)
|
||||
*/
|
||||
public class NullLogger extends POILogger {
|
||||
@Override
|
||||
public void initialize(final String cat){
|
||||
public void initialize(final String cat) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
@ -41,8 +37,7 @@ public class NullLogger extends POILogger {
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void log(final int level, final Object obj1)
|
||||
{
|
||||
public void log(final int level, final Object obj1) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
@ -53,6 +48,7 @@ public class NullLogger extends POILogger {
|
||||
* @param obj1 The object to log. This is converted to a string.
|
||||
* @param exception An exception to be logged
|
||||
*/
|
||||
@Override
|
||||
public void log(int level, Object obj1, final Throwable exception) {
|
||||
// do nothing
|
||||
}
|
||||
|
@ -24,15 +24,12 @@ package org.apache.poi.util;
|
||||
* developers to write log calls, while simultaneously making those
|
||||
* calls as cheap as possible by performing lazy evaluation of the log
|
||||
* message.
|
||||
*
|
||||
* @author Marc Johnson (mjohnson at apache dot org)
|
||||
* @author Glen Stampoultzis (glens at apache.org)
|
||||
* @author Nicola Ken Barozzi (nicolaken at apache.org)
|
||||
*/
|
||||
public class SystemOutLogger extends POILogger
|
||||
{
|
||||
private String _cat;
|
||||
|
||||
@Override
|
||||
public void initialize(final String cat)
|
||||
{
|
||||
this._cat=cat;
|
||||
@ -44,7 +41,7 @@ public class SystemOutLogger extends POILogger
|
||||
* @param level One of DEBUG, INFO, WARN, ERROR, FATAL
|
||||
* @param obj1 The object to log.
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void log(final int level, final Object obj1)
|
||||
{
|
||||
log(level, obj1, null);
|
||||
@ -57,6 +54,7 @@ public class SystemOutLogger extends POILogger
|
||||
* @param obj1 The object to log. This is converted to a string.
|
||||
* @param exception An exception to be logged
|
||||
*/
|
||||
@Override
|
||||
@SuppressForbidden("uses printStackTrace")
|
||||
public void log(final int level, final Object obj1,
|
||||
final Throwable exception) {
|
||||
@ -78,6 +76,7 @@ public class SystemOutLogger extends POILogger
|
||||
* @see #ERROR
|
||||
* @see #FATAL
|
||||
*/
|
||||
@Override
|
||||
public boolean check(final int level)
|
||||
{
|
||||
int currentLevel;
|
||||
|
@ -30,16 +30,20 @@ public class DummyPOILogger extends POILogger {
|
||||
logged = new ArrayList<String>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean check(int level) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize(String cat) {}
|
||||
|
||||
@Override
|
||||
public void log(int level, Object obj1) {
|
||||
logged.add(level + " - " + obj1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void log(int level, Object obj1, Throwable exception) {
|
||||
logged.add(level + " - " + obj1 + " - " + exception);
|
||||
}
|
||||
|
@ -26,10 +26,6 @@ import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Tests the log class.
|
||||
*
|
||||
* @author Glen Stampoultzis (glens at apache.org)
|
||||
* @author Marc Johnson (mjohnson at apache dot org)
|
||||
* @author Nicola Ken Barozzi (nicolaken at apache.org)
|
||||
*/
|
||||
public final class TestPOILogger extends POILogger {
|
||||
private String lastLog = "";
|
||||
@ -61,20 +57,26 @@ public final class TestPOILogger extends POILogger {
|
||||
POILogFactory._loggerClassName = oldLCN;
|
||||
}
|
||||
}
|
||||
|
||||
// ---------- POI Logger methods implemented for testing ----------
|
||||
|
||||
@Override
|
||||
public void initialize(String cat) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void log(int level, Object obj1) {
|
||||
lastLog = (obj1 == null) ? "" : obj1.toString();
|
||||
lastEx = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void log(int level, Object obj1, Throwable exception) {
|
||||
lastLog = (obj1 == null) ? "" : obj1.toString();
|
||||
lastEx = exception;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean check(int level) {
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user