org.sandev.basics.util
Class UserWorkLog

java.lang.Object
  extended by org.sandev.basics.util.UserWorkLog
All Implemented Interfaces:
Logger

public class UserWorkLog
extends java.lang.Object
implements Logger

An accumulative logger for messages to be delivered to the user while the system does work. Typically this is used to provide some progress or detail information for extensive user actions.


Field Summary
protected  java.lang.StringBuffer buf
          Our cumulative buffer for log messages.
protected  boolean levelPrefixing
          Whether log messages are prefixed with the level or not.
protected  int logLevel
          Severity cutoff for log messages.
protected  boolean messages
          A flag indicating whether there are log messages available or not.
 
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
UserWorkLog()
          General ctor does nothing.
UserWorkLog(java.lang.String instanceName, boolean usePrefix)
          Calls init and setLevelPrefixing with usePrefix.
 
Method Summary
 java.lang.StringBuffer getBuf()
          accessor for buf
 boolean getLevelPrefixing()
          accessor for levelPrefixing
 int getLogLevel()
          accessor for logLevel
 boolean hasMessages()
          accessor for messages
 void init(java.lang.String instanceName)
          The instanceName is ignored in this case, since this logger is used by the UI, and represents cumulative processing information.
 void log(int severity, java.lang.String msg)
          Add this message to our buffer, followed by a linefeed.
 void log(java.lang.String msg)
          Shorthand for a LOGLEVEL_INFO message
 void logwarn(java.lang.String msg)
          Shorthand for a LOGLEVEL_WARN message
 void setBuf(java.lang.StringBuffer buf)
          mutator for buf
 void setLevelPrefixing(boolean val)
          mutator for levelPrefixing
 void setLogLevel(int val)
          mutator for logLevel
 void setMessages(boolean val)
          mutator for messages
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

buf

protected java.lang.StringBuffer buf
Our cumulative buffer for log messages.


messages

protected boolean messages
A flag indicating whether there are log messages available or not.


logLevel

protected int logLevel
Severity cutoff for log messages.


levelPrefixing

protected boolean levelPrefixing
Whether log messages are prefixed with the level or not.

Constructor Detail

UserWorkLog

public UserWorkLog()
General ctor does nothing. Call init before using.


UserWorkLog

public UserWorkLog(java.lang.String instanceName,
                   boolean usePrefix)
Calls init and setLevelPrefixing with usePrefix.

Method Detail

getBuf

public java.lang.StringBuffer getBuf()
accessor for buf


setBuf

public void setBuf(java.lang.StringBuffer buf)
mutator for buf


hasMessages

public boolean hasMessages()
accessor for messages


setMessages

public void setMessages(boolean val)
mutator for messages


getLogLevel

public int getLogLevel()
accessor for logLevel

Specified by:
getLogLevel in interface Logger

setLogLevel

public void setLogLevel(int val)
mutator for logLevel

Specified by:
setLogLevel in interface Logger

getLevelPrefixing

public boolean getLevelPrefixing()
accessor for levelPrefixing


setLevelPrefixing

public void setLevelPrefixing(boolean val)
mutator for levelPrefixing


init

public void init(java.lang.String instanceName)
The instanceName is ignored in this case, since this logger is used by the UI, and represents cumulative processing information.

Specified by:
init in interface Logger

log

public void log(int severity,
                java.lang.String msg)
Add this message to our buffer, followed by a linefeed.

Specified by:
log in interface Logger

log

public void log(java.lang.String msg)
Shorthand for a LOGLEVEL_INFO message


logwarn

public void logwarn(java.lang.String msg)
Shorthand for a LOGLEVEL_WARN message