net.sf.wraplog
Class AbstractLogger

    java.lang.Object
    extended bynet.sf.wraplog.AbstractLogger
Direct Known Subclasses:
NoneLogger, SystemLogger, TestAppLogger

public abstract class AbstractLogger
extends Object

Abstract base class to write messages about interesting things happening to a log.

Updated to WrapLog version 1.1.

Author:
Thomas Aglassinger

Constructor Summary
AbstractLogger()
           
 
Method Summary
protected  void checkLevel(int logLevel, String name)
           
 void debug(String message)
           
 void debug(String message, Throwable error)
           
 void error(String message)
           
 void error(String message, Throwable error)
           
 int getLevel()
           
 int getLoggedMessageCount()
          Count of how many messages have been logged.
 void info(String message)
           
 void info(String message, Throwable error)
           
 boolean isDebugEnabled()
           
 boolean isEnabled(int logLevel)
           
 boolean isErrorEnabled()
           
 boolean isInfoEnabled()
           
 boolean isWarnEnabled()
           
 void log(int logLevel, String message)
          Provided that getLevel() accepts it, log message.
 void log(int logLevel, String message, Throwable error)
          Provided that getLevel() accepts it, log message and error.
protected abstract  void reallyLog(int logLevel, String message, Throwable error)
          Logs a message and optional error details.
 void setLevel(int newLevel)
           
 void warn(String message)
           
 void warn(String message, Throwable error)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractLogger

    public AbstractLogger()
Method Detail

checkLevel

    protected void checkLevel(int logLevel,
    String name)

debug

    public void debug(String message)

debug

    public void debug(String message,
    Throwable error)

error

    public void error(String message)

error

    public void error(String message,
    Throwable error)

getLevel

    public int getLevel()

getLoggedMessageCount

    public int getLoggedMessageCount()
Count of how many messages have been logged.


info

    public void info(String message)

info

    public void info(String message,
    Throwable error)

isEnabled

    public boolean isEnabled(int logLevel)

reallyLog

    protected abstract void reallyLog(int logLevel,
    String message,
    Throwable error)
    throws Exception
Logs a message and optional error details.

Parameters:
logLevel - one of: Level.DEBUG, Level.INFO, Level.WARN, Level.ERROR
message - the actual message; this will never be null
error - an error that is related to the message; unless null, the name and stack trace of the error are logged
Throws:
Exception

log

    public void log(int logLevel,
    String message)
Provided that getLevel() accepts it, log message. Otherwise, do nothing.


log

    public void log(int logLevel,
    String message,
    Throwable error)
Provided that getLevel() accepts it, log message and error. Otherwise, do nothing.


setLevel

    public void setLevel(int newLevel)

warn

    public void warn(String message)

isDebugEnabled

    public boolean isDebugEnabled()

isInfoEnabled

    public boolean isInfoEnabled()

isWarnEnabled

    public boolean isWarnEnabled()

isErrorEnabled

    public boolean isErrorEnabled()

warn

    public void warn(String message,
    Throwable error)