|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectau.gov.tas.dpiwe.mr.util.Messenger
public class Messenger
A utility class used to print logging messages at various levels.
This class is a simple implementation using standard output as the console. It adds no time signature information to the messages before printing them.
| Field Summary | |
|---|---|
protected boolean |
console
Set to true to echo messages on the standard output device. |
protected boolean |
error
Set to true to echo messages on the standard error stream. |
protected Map |
exceptionMessageTable
Lists the messages to be displayed for various exception types. |
protected boolean |
exceptionsToConsole
Set to true to echo exception stack traces on the standard output device. |
protected boolean |
exceptionsToError
Set to true to echo exception stack traces on the standard error stream. |
static int |
Level_Debug
The message level which displays debugging messages. |
static int |
Level_Exception
The message level which displays exception messages (unless tagged at zero or with a negative number.) |
static int |
Level_None
The message level which displays no messages (unless tagged at zero or with a negative number.) |
static int |
Level_Normal
The message level which displays normal command-level logging messages. |
protected int |
messageLevel
Indicates the present message level. |
| Constructor Summary | |
|---|---|
Messenger()
|
|
| Method Summary | |
|---|---|
void |
debugEmptyMessage()
Starts a new line after debugging messages. |
Object |
debugEmptyMessage(Object message)
Starts a new line after debugging messages. |
Object |
debugMessage(Object message)
Prints a debugging message related to an object, starting a new line afterward. |
Object |
debugMessage(Object message,
MessageFormat format)
Prints a debugging message related to an object, starting a new line afterward. |
Object |
debugMessage(String prefix,
String suffix,
Object message)
Prints a debugging message related to an object, starting a new line afterward. |
Object |
debugMessageFirstPart(Object message)
Prints a debugging message related to an object. |
Object |
debugMessageFirstPart(String prefix,
String suffix,
Object message)
Prints a debugging message related to an object. |
Object |
debugMessageLastPart(Object message)
Prints a debugging message related to an object, starting a new line afterward. |
Object |
debugMessageLastPart(String prefix,
String suffix,
Object message)
Prints a debugging message related to an object, starting a new line afterward. |
Object |
debugMessagePart(Object message)
Prints a debugging message related to an object. |
Object |
debugMessagePart(String prefix,
String suffix,
Object message)
Prints a debugging message related to an object. |
void |
debugStackTrace(Throwable throwable)
Prints a debugging stack trace. |
boolean |
debugStackTrace2(Throwable throwable)
Prints a debugging stack trace. |
void |
emptyMessage()
Starts a new line after command-level logging. |
void |
emptyMessage(int atLevel)
Starts a new line after level tagged logging. |
Object |
emptyMessage(int atLevel,
Object message)
Starts a new line after level tagged logging. |
Object |
emptyMessage(Object message)
Starts a new line after command-level logging. |
int |
getMessageLevel()
Returns the level at which messages will be output. |
static boolean |
isTweenMessage(String tween)
Returns true if tween contains what looks like a method call to this object which can take a prefix and a suffix. |
Object |
message(int atLevel,
Object message)
Prints a level tagged logging message related to an object, starting a new line afterward. |
Object |
message(int atLevel,
Object message,
MessageFormat format)
Prints a level tagged logging message related to an object, starting a new line afterward. |
Object |
message(int atLevel,
String prefix,
String suffix,
Object message)
Prints a level tagged logging message related to an object, starting a new line afterward. |
Object |
message(Object message)
Prints a command-level logging message related to an object, starting a new line afterward. |
Object |
message(Object message,
MessageFormat format)
Prints a command-level logging message related to an object, starting a new line afterward. |
Object |
message(String prefix,
String suffix,
Object message)
Prints a command-level logging message related to an object, starting a new line afterward. |
Object |
messageFirstPart(int atLevel,
Object message)
Prints a level tagged logging message related to an object. |
Object |
messageFirstPart(int atLevel,
String prefix,
String suffix,
Object message)
Prints a level tagged logging message related to an object. |
Object |
messageFirstPart(Object message)
Prints a command-level logging message related to an object. |
Object |
messageFirstPart(String prefix,
String suffix,
Object message)
Prints a command-level logging message related to an object. |
Object |
messageLastPart(int atLevel,
Object message)
Prints a level tagged logging message related to an object, starting a new line afterward. |
Object |
messageLastPart(int atLevel,
String prefix,
String suffix,
Object message)
Prints a level tagged logging message related to an object, starting a new line afterward. |
Object |
messageLastPart(Object message)
Prints a command-level logging message related to an object, starting a new line afterward. |
Object |
messageLastPart(String prefix,
String suffix,
Object message)
Prints a command-level logging message related to an object, starting a new line afterward. |
Object |
messagePart(int atLevel,
Object message)
Prints a level tagged logging message related to an object. |
Object |
messagePart(int atLevel,
Object message,
MessageFormat format)
Prints a level tagged logging message related to an object. |
Object |
messagePart(int atLevel,
String prefix,
String suffix,
Object message)
Prints a level tagged logging message related to an object. |
Object |
messagePart(Object message)
Prints a command-level logging message related to an object. |
Object |
messagePart(Object message,
MessageFormat format)
Prints a command-level logging message related to an object. |
Object |
messagePart(String prefix,
String suffix,
Object message)
Prints a command-level logging message related to an object. |
boolean |
prettyException(Throwable throwable)
Prints a pretty exception message. |
void |
queryReport(Throwable throwable,
String query)
Reports a failed query. |
void |
setConsoleOutput(boolean console)
Sets whether this messenger should direct messages to the standard output stream or GUI component. |
void |
setConsoleOutput(boolean console,
boolean exceptionsToConsole)
Sets whether this messenger should direct messages to the standard output stream or GUI component. |
void |
setErrorOutput(boolean error)
Sets whether this messenger should direct messages to the standard error stream. |
void |
setErrorOutput(boolean error,
boolean exceptionsToError)
Sets whether this messenger should direct messages to the standard error stream. |
void |
setMessageLevel(int messageLevel)
Sets the level at which messages should be output. |
void |
setOutput(boolean output)
Sets whether this messenger should suppress all messages or produce messages on all outputs. |
void |
stackTrace(Throwable throwable)
Prints a stack trace. |
boolean |
stackTrace2(Throwable throwable)
Prints a stack trace. |
void |
success()
Prints a success message. |
void |
success(int atLevel)
Prints a success message. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected boolean console
protected boolean error
protected boolean exceptionsToConsole
protected boolean exceptionsToError
protected int messageLevel
public static final int Level_None
public static final int Level_Exception
public static final int Level_Normal
public static final int Level_Debug
protected Map exceptionMessageTable
| Constructor Detail |
|---|
public Messenger()
| Method Detail |
|---|
public void setOutput(boolean output)
output - true to direct messages to standard output
or GUI component and standard error as well, false to
suppress all messages.public void setConsoleOutput(boolean console)
error - true to direct messages to standard output
or GUI component, false otherwise.
public void setConsoleOutput(boolean console,
boolean exceptionsToConsole)
error - true to direct messages to standard output
or GUI component, false otherwise.exceptionsToConsole - true to direct stack traces to standard output
or GUI component, false otherwise.public void setErrorOutput(boolean error)
error - true to direct messages to standard error,
false otherwise.
public void setErrorOutput(boolean error,
boolean exceptionsToError)
error - true to direct messages to standard error,
false otherwise.exceptionsToError - true to direct stack traces to standard error,
false otherwise.public void setMessageLevel(int messageLevel)
level - one of the constant values Level_None, Level_Normal or
Level_Debug, or some other level constant defined by a subclass.public int getMessageLevel()
public Object messageFirstPart(int atLevel,
String prefix,
String suffix,
Object message)
atLevel - the level at which this message is tagged.
Prints a command-level logging message related to an object.message - the subject of the message.prefix - commentary prepended to the subject.suffix - commentary appended to the subject.
public Object messagePart(int atLevel,
String prefix,
String suffix,
Object message)
atLevel - the level at which this message is tagged.message - the subject of the message.prefix - commentary prepended to the subject.suffix - commentary appended to the subject.
public Object messageLastPart(int atLevel,
String prefix,
String suffix,
Object message)
atLevel - the level at which this message is tagged.message - the subject of the message.prefix - commentary prepended to the subject.suffix - commentary appended to the subject.
public Object message(int atLevel,
String prefix,
String suffix,
Object message)
atLevel - the level at which this message is tagged.message - the subject of the message.prefix - commentary prepended to the subject.suffix - commentary appended to the subject.
public Object messageFirstPart(int atLevel,
Object message)
message - the subject of the message.
public Object messagePart(int atLevel,
Object message)
message - the subject of the message.
public Object messagePart(int atLevel,
Object message,
MessageFormat format)
atLevel - the level at which this message is tagged.message - the subject of the message.format - a context to display the subject.
public Object messageLastPart(int atLevel,
Object message)
atLevel - the level at which this message is tagged.message - the subject of the message.
public Object message(int atLevel,
Object message)
atLevel - the level at which this message is tagged.message - the subject of the message.
public Object message(int atLevel,
Object message,
MessageFormat format)
atLevel - the level at which this message is tagged.message - the subject of the message.format - a context to display the subject.
public Object emptyMessage(int atLevel,
Object message)
atLevel - the level at which this message is tagged.message - the subject of the message.
public void emptyMessage(int atLevel)
atLevel - the level at which this message is tagged.
public Object debugMessageFirstPart(String prefix,
String suffix,
Object message)
message - the subject of the message.prefix - commentary prepended to the subject.suffix - commentary appended to the subject.
public Object debugMessagePart(String prefix,
String suffix,
Object message)
message - the subject of the message.prefix - commentary prepended to the subject.suffix - commentary appended to the subject.
public Object debugMessageLastPart(String prefix,
String suffix,
Object message)
message - the subject of the message.prefix - commentary prepended to the subject.suffix - commentary appended to the subject.
public Object debugMessage(String prefix,
String suffix,
Object message)
message - the subject of the message.prefix - commentary prepended to the subject.suffix - commentary appended to the subject.
public Object debugMessageFirstPart(Object message)
message - the subject of the message.
public Object debugMessagePart(Object message)
message - the subject of the message.
public Object debugMessageLastPart(Object message)
message - the subject of the message.
public Object debugMessage(Object message)
message - the subject of the message.
public Object debugMessage(Object message,
MessageFormat format)
message - the subject of the message.format - a context to display the subject.
public Object debugEmptyMessage(Object message)
message - the subject of the message.
public void debugEmptyMessage()
public void success(int atLevel)
public boolean prettyException(Throwable throwable)
This call indirects via message().
throwable - the exception or error containing the stack trace.
public void stackTrace(Throwable throwable)
throwable - the exception or error containing the stack trace.public boolean stackTrace2(Throwable throwable)
throwable - the exception or error containing the stack trace.
public void debugStackTrace(Throwable throwable)
throwable - the exception or error containing the stack trace.public boolean debugStackTrace2(Throwable throwable)
throwable - the exception or error containing the stack trace.
public void queryReport(Throwable throwable,
String query)
throwable - the exception or error the query produced.query - the query statement.
public Object messageFirstPart(String prefix,
String suffix,
Object message)
message - the subject of the message.prefix - commentary prepended to the subject.suffix - commentary appended to the subject.
public Object messagePart(String prefix,
String suffix,
Object message)
message - the subject of the message.prefix - commentary prepended to the subject.suffix - commentary appended to the subject.
public Object messageLastPart(String prefix,
String suffix,
Object message)
message - the subject of the message.prefix - commentary prepended to the subject.suffix - commentary appended to the subject.
public Object message(String prefix,
String suffix,
Object message)
message - the subject of the message.prefix - commentary prepended to the subject.suffix - commentary appended to the subject.
public Object messageFirstPart(Object message)
message - the subject of the message.
public Object messagePart(Object message)
message - the subject of the message.
public Object messagePart(Object message,
MessageFormat format)
message - the subject of the message.format - a context to display the subject.
public Object messageLastPart(Object message)
message - the subject of the message.
public Object message(Object message)
message - the subject of the message.
public Object message(Object message,
MessageFormat format)
message - the subject of the message.format - a context to display the subject.
public Object emptyMessage(Object message)
message - the subject of the message.
public void emptyMessage()
public void success()
public static boolean isTweenMessage(String tween)
tween - a fragment of Java code.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||