Fixed up some issues with the system out logger.

git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/branches/REL_2_BRANCH@353334 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Glen Stampoultzis 2003-09-04 03:47:25 +00:00
parent 3e26a5403a
commit e57ffd3bf5

View File

@ -63,13 +63,12 @@ import java.util.*;
* A logger class that strives to make it as easy as possible for * A logger class that strives to make it as easy as possible for
* developers to write log calls, while simultaneously making those * developers to write log calls, while simultaneously making those
* calls as cheap as possible by performing lazy evaluation of the log * calls as cheap as possible by performing lazy evaluation of the log
* message.<p> * message.
* *
* @author Marc Johnson (mjohnson at apache dot org) * @author Marc Johnson (mjohnson at apache dot org)
* @author Glen Stampoultzis (glens at apache.org) * @author Glen Stampoultzis (glens at apache.org)
* @author Nicola Ken Barozzi (nicolaken at apache.org) * @author Nicola Ken Barozzi (nicolaken at apache.org)
*/ */
public class SystemOutLogger extends POILogger public class SystemOutLogger extends POILogger
{ {
private String cat; private String cat;
@ -88,6 +87,7 @@ public class SystemOutLogger extends POILogger
public void log(final int level, final Object obj1) public void log(final int level, final Object obj1)
{ {
if (check(level))
System.out.println("["+cat+"] "+obj1); System.out.println("["+cat+"] "+obj1);
} }
@ -95,12 +95,19 @@ public class SystemOutLogger extends POILogger
* Check if a logger is enabled to log at the specified level * Check if a logger is enabled to log at the specified level
* *
* @param level One of DEBUG, INFO, WARN, ERROR, FATAL * @param level One of DEBUG, INFO, WARN, ERROR, FATAL
* @param obj1 The logger to check. * @see #DEBUG
* @see #INFO
* @see #WARN
* @see #ERROR
* @see #FATAL
*/ */
public boolean check(final int level) public boolean check(final int level)
{ {
int currentLevel = Integer.parseInt(System.getProperty("poi.log.level", WARN + ""));
if (level >= currentLevel)
return true; return true;
else
return false;
} }