From 08fc8ae7556f01ceebe0de9f3f1c3b5007ea935d Mon Sep 17 00:00:00 2001 From: Glen Stampoultzis Date: Thu, 4 Sep 2003 03:50:04 +0000 Subject: [PATCH] Same changes but to the head. git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@353335 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/poi/util/SystemOutLogger.java | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/java/org/apache/poi/util/SystemOutLogger.java b/src/java/org/apache/poi/util/SystemOutLogger.java index ccd9522a12..a9950513b3 100644 --- a/src/java/org/apache/poi/util/SystemOutLogger.java +++ b/src/java/org/apache/poi/util/SystemOutLogger.java @@ -55,21 +55,18 @@ */ package org.apache.poi.util; -import org.apache.commons.logging.Log; -import java.util.*; /** * A logger class that strives to make it as easy as possible for * developers to write log calls, while simultaneously making those * calls as cheap as possible by performing lazy evaluation of the log - * message.

+ * 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; @@ -78,7 +75,7 @@ public class SystemOutLogger extends POILogger { this.cat=cat; } - + /** * Log a message * @@ -88,21 +85,29 @@ public class SystemOutLogger extends POILogger public void log(final int level, final Object obj1) { - System.out.println("["+cat+"] "+obj1); + if (check(level)) + System.out.println("["+cat+"] "+obj1); } /** * Check if a logger is enabled to log at the specified level * * @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) { - return true; + int currentLevel = Integer.parseInt(System.getProperty("poi.log.level", WARN + "")); + if (level >= currentLevel) + return true; + else + return false; } - + } // end package scope class POILogger