pt.digitalis.log
Class BaseLogWrapper

java.lang.Object
  extended by pt.digitalis.log.BaseLogWrapper
All Implemented Interfaces:
ILogWrapper
Direct Known Subclasses:
LogWrapperLog4JImpl

public abstract class BaseLogWrapper
extends Object
implements ILogWrapper

This class provides a standard base implementation of the logger API as specified by the interface ILogWrapper. The goal of this class is to facilitate the development of new Implementation classes of the logger API as defined by ILogWrapper.

Author:
Rodrigo Gonçalves rgoncalves@digitalis.pt, Pedro Viegas pviegas@digitalis.pt

Field Summary
protected  String indentationString
          Indentation control variable
 
Constructor Summary
BaseLogWrapper()
           
 
Method Summary
 void debug(Object message)
          Logs a message with 'Debug' Level.
 void decreaseIndentation()
          Decreases logging indentation
 void error(Object message)
          Logs a message with 'Error' Level.
 void fatal(Object message)
          Logs a message with 'Fatal' Level.
 String getIndentationString()
          Returns the indentation string
 void increaseIndentation()
          Increases logging indentation.
 void info(Object message)
          Logs a message with 'Info' Level.
 boolean isDebugEnabled()
          Inspector for the LogWrapper 'Debug' level
 boolean isErrorEnabled()
          Inspector for the LogWrapper 'Error' level
 boolean isFatalEnabled()
          Inspector for the LogWrapper 'Fatal' level
 boolean isInfoEnabled()
          Inspector for the LogWrapper 'Info' level
 boolean isTraceEnabled()
          Inspector for the LogWrapper 'Trace' level
 boolean isWarnEnabled()
          Inspector for the LogWrapper 'Warn' level
 void log(LogLevel level, Object message)
          Logging method.
 void setDebugLogLevel()
          Sets the log level to 'Debug'.
 void setErrorLogLevel()
          Sets the log level to 'Error'.
 void setFatalLogLevel()
          Sets the log level to 'Fatal'.
 void setInfoLogLevel()
          Sets the log level to 'Info'.
 void setTraceLogLevel()
          Sets the log level to 'Trace'.
 void setWarnLogLevel()
          Sets the log level to 'Warn'.
 void trace(Object message)
          Logs a message with 'Trace' Level.
 void warn(Object message)
          Logs a message with 'Warn' Level.
protected abstract  void writeLog(LogLevel level, Object message)
          Executes the actual writting operation of the LOG.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface pt.digitalis.log.ILogWrapper
getLevel, setLevel
 

Field Detail

indentationString

protected String indentationString
Indentation control variable

Constructor Detail

BaseLogWrapper

public BaseLogWrapper()
Method Detail

trace

public void trace(Object message)
Logs a message with 'Trace' Level.

Specified by:
trace in interface ILogWrapper
Parameters:
message - the message to log

debug

public void debug(Object message)
Logs a message with 'Debug' Level.

Specified by:
debug in interface ILogWrapper
Parameters:
message - the message to log

info

public void info(Object message)
Logs a message with 'Info' Level.

Specified by:
info in interface ILogWrapper
Parameters:
message - the message to log

warn

public void warn(Object message)
Logs a message with 'Warn' Level.

Specified by:
warn in interface ILogWrapper
Parameters:
message - the message to log

error

public void error(Object message)
Logs a message with 'Error' Level.

Specified by:
error in interface ILogWrapper
Parameters:
message - the message to log

fatal

public void fatal(Object message)
Logs a message with 'Fatal' Level.

Specified by:
fatal in interface ILogWrapper
Parameters:
message - the message to log

writeLog

protected abstract void writeLog(LogLevel level,
                                 Object message)
Executes the actual writting operation of the LOG. Is called from the method log(LogLevel, Object) and receives the interpreted message to write (including identation)

Parameters:
level - the LogLevel
message - the compiled message to write to log

log

public final void log(LogLevel level,
                      Object message)
Description copied from interface: ILogWrapper
Logging method.

Specified by:
log in interface ILogWrapper
Parameters:
level - the log level
message - the message to log
See Also:
ILogWrapper.log(pt.digitalis.log.LogLevel, java.lang.Object)

isTraceEnabled

public boolean isTraceEnabled()
Inspector for the LogWrapper 'Trace' level

Specified by:
isTraceEnabled in interface ILogWrapper
Returns:
T if the Trace Level is enabled on the LogWrapper, F otherwise

isDebugEnabled

public boolean isDebugEnabled()
Inspector for the LogWrapper 'Debug' level

Specified by:
isDebugEnabled in interface ILogWrapper
Returns:
T if the Debug Level is enabled on the LogWrapper, F otherwise

isInfoEnabled

public boolean isInfoEnabled()
Inspector for the LogWrapper 'Info' level

Specified by:
isInfoEnabled in interface ILogWrapper
Returns:
T if the Info Level is enabled on the LogWrapper, F otherwise

isWarnEnabled

public boolean isWarnEnabled()
Inspector for the LogWrapper 'Warn' level

Specified by:
isWarnEnabled in interface ILogWrapper
Returns:
T if the Warn Level is enabled on the LogWrapper, F otherwise

isErrorEnabled

public boolean isErrorEnabled()
Inspector for the LogWrapper 'Error' level

Specified by:
isErrorEnabled in interface ILogWrapper
Returns:
T if the Error Level is enabled on the LogWrapper, F otherwise

isFatalEnabled

public boolean isFatalEnabled()
Inspector for the LogWrapper 'Fatal' level

Specified by:
isFatalEnabled in interface ILogWrapper
Returns:
T if the Fatal Level is enabled on the LogWrapper, F otherwise

setTraceLogLevel

public void setTraceLogLevel()
Sets the log level to 'Trace'.

Specified by:
setTraceLogLevel in interface ILogWrapper

setDebugLogLevel

public void setDebugLogLevel()
Sets the log level to 'Debug'.

Specified by:
setDebugLogLevel in interface ILogWrapper

setInfoLogLevel

public void setInfoLogLevel()
Sets the log level to 'Info'.

Specified by:
setInfoLogLevel in interface ILogWrapper

setWarnLogLevel

public void setWarnLogLevel()
Sets the log level to 'Warn'.

Specified by:
setWarnLogLevel in interface ILogWrapper

setErrorLogLevel

public void setErrorLogLevel()
Sets the log level to 'Error'.

Specified by:
setErrorLogLevel in interface ILogWrapper

setFatalLogLevel

public void setFatalLogLevel()
Sets the log level to 'Fatal'.

Specified by:
setFatalLogLevel in interface ILogWrapper

increaseIndentation

public void increaseIndentation()
Increases logging indentation.

Specified by:
increaseIndentation in interface ILogWrapper

decreaseIndentation

public void decreaseIndentation()
Decreases logging indentation

Specified by:
decreaseIndentation in interface ILogWrapper

getIndentationString

public String getIndentationString()
Returns the indentation string

Specified by:
getIndentationString in interface ILogWrapper
Returns:
the indentation string.


Copyright © 2010 Digitalis Informática Lda. All Rights Reserved.