org.sandev.tools.util
Class SandLogger

java.lang.Object
  extended by org.sandev.tools.util.SandLogger
All Implemented Interfaces:
org.sandev.basics.nodecommon.Logger
Direct Known Subclasses:
SandTimestampLogger

public class SandLogger
extends java.lang.Object
implements org.sandev.basics.nodecommon.Logger

A simple println logger. This is about as straightforward as it gets, and is appropriate for use within a container that wraps and timestamps calls to stdout. Uses minimal prefixing to show the source and level.


Field Summary
protected  int logLevel
          The current SAND log level.
protected  java.lang.String sourceID
          An identifying sourceID used for log output.
 
Fields inherited from interface org.sandev.basics.nodecommon.Logger
LOGLEVEL_DEBUG, LOGLEVEL_ERROR, LOGLEVEL_FATAL, LOGLEVEL_INFO, LOGLEVEL_STR_DEBUG, LOGLEVEL_STR_ERROR, LOGLEVEL_STR_FATAL, LOGLEVEL_STR_INFO, LOGLEVEL_STR_WARN, LOGLEVEL_STRINGS, LOGLEVEL_WARN
 
Constructor Summary
SandLogger()
          Default ctor does nothing.
 
Method Summary
 int getLogLevel()
          Return the log level.
 java.lang.String getSourceID()
          Return the sourceID
 void init(java.lang.String instanceName)
          Initialize our native logger using the specified instance name
 void log(int severity, java.lang.String msg)
          Implementation of the required log method.
 void setLogLevel(int logLevel)
          Set the log level.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logLevel

protected int logLevel
The current SAND log level.


sourceID

protected java.lang.String sourceID
An identifying sourceID used for log output. This is set in the init method.

Constructor Detail

SandLogger

public SandLogger()
Default ctor does nothing. Call the init method for setup.

Method Detail

setLogLevel

public void setLogLevel(int logLevel)
Set the log level.

Specified by:
setLogLevel in interface org.sandev.basics.nodecommon.Logger

getLogLevel

public int getLogLevel()
Return the log level.

Specified by:
getLogLevel in interface org.sandev.basics.nodecommon.Logger

getSourceID

public java.lang.String getSourceID()
Return the sourceID


init

public void init(java.lang.String instanceName)
          throws org.sandev.basics.nodecommon.LoggerException
Initialize our native logger using the specified instance name

Specified by:
init in interface org.sandev.basics.nodecommon.Logger
Throws:
org.sandev.basics.nodecommon.LoggerException

log

public void log(int severity,
                java.lang.String msg)
         throws org.sandev.basics.nodecommon.LoggerException
Implementation of the required log method. See the Logger interface documentation for details.

Specified by:
log in interface org.sandev.basics.nodecommon.Logger
Throws:
org.sandev.basics.nodecommon.LoggerException