Class Diagnostic
There are six levels of increasing message severity:
DEBUG, INFORMATION, STATUS, WARNING, ERROR and FATAL. The application
programs will indicate the severity of the message. The
setSeverity(int)
method will establish the threshold that
below which messages will be ignored. Messages that are displayed
are written to the console, and optionally displayed in a popup window.
The default value of the severity indicator is INFORMATION. To change
the use a line similer to the following:
Diagnostic.setSeverity(Diagnostic.WARNING);
The setGuiMode(int)
method will control if a popup window will
display the message. Any messages below the severity of this setting
will not display in a popup. The default value of the setGuiMode
setting is WARNING.
Some messages are repetitive, and these can be ignored using the
options in the popup window. Batch mode programs can also ignore
repetitive messages by setting the setOnceOnly(boolean)
flag.
This will cause repetitive messages that are not being displayed
in a popup window to not display more than the first instance of the
message. A useful batch mode setting would be:
Diagnostic.setGuiMode(Diagnostic.ERROR); Diagnostic.setOnceOnly(true);
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
Display a debug message using the default formatstatic String
encodeHTMLString(String text)
This routine will encode a string using HTML-safe characters.static void
Display an error message using the default formatstatic void
static void
Display a fatal message using the default format and exitstatic void
static String
getAllCauses(Throwable th)
static int
Get the debug verbosity level.static int
Get the current value of the GUI display mode.static boolean
getOnceOnly(int level)
Determine if OnceOnly display mode will be used for a given message severity level.static int
Get the current message suppression level.static void
information(String message)
Display an information message using the default formatstatic boolean
isDebug()
Are debugging messages requested?static int
Display a message using the specified severity level, and also provide a list of option buttons.static int
Display a message using the specified severity level, and also provide a list of option buttons.static void
setDebugLevel(int level)
Control the amount of debugging information to be display.static void
setGuiMode(int level)
Set the level at which messages will be displayed using the GUI popup dialog.static void
setOnceOnly(boolean mode)
Set a flag that indicates that repetative messages should only be displayed once.static void
setSeverity(int level)
Set the level at which messages will be displayed or ignored.static void
Display an information message using the default formatstatic void
Display a warning message using the default formatstatic void
-
Field Details
-
NONE
public static final int NONE- See Also:
- Constant Field Values
-
FATAL
public static final int FATAL- See Also:
- Constant Field Values
-
ERROR
public static final int ERROR- See Also:
- Constant Field Values
-
WARNING
public static final int WARNING- See Also:
- Constant Field Values
-
STATUS
public static final int STATUS- See Also:
- Constant Field Values
-
INFORMATION
public static final int INFORMATION- See Also:
- Constant Field Values
-
DEBUG
public static final int DEBUG- See Also:
- Constant Field Values
-
ALL
public static final int ALL- See Also:
- Constant Field Values
-
-
Constructor Details
-
Diagnostic
public Diagnostic()
-
-
Method Details
-
setGuiMode
public static void setGuiMode(int level)Set the level at which messages will be displayed using the GUI popup dialog. The choices are (in order of increasing severity) DEBUG, INFORMATION, WARNING, ERROR and FATAL. A popup window will be used to display all message that are at the same or higher level of severity of the setting that is used.For example, setting the vallue of
will prevent warning messages from popping up and blocking the model progress. To reset the behaviour to the initial default useDiagnostic.setSeverity(Diagnostic.ERROR);
Diagnostic.setSeverity(Diagnostic.WARNING);
-
getGuiMode
public static int getGuiMode()Get the current value of the GUI display mode. -
setSeverity
public static void setSeverity(int level)Set the level at which messages will be displayed or ignored. The choices are (in order of increasing severity) DEBUG, INFORMATION, WARNING, ERROR and FATAL. Any messages that are of less severity than the provided value will be suppressed. These messages will be printed on the console. In addition, messages can also be displayed in a popup window, and will pause the model. Popup messages are controlled using thesetGuiMode(int)
method. -
getSeverity
public static int getSeverity()Get the current message suppression level. -
setDebugLevel
public static void setDebugLevel(int level)Control the amount of debugging information to be display. If messages of DEBUG severity are displayed, then this method will control the amount of debug data that is emitted. This is generally only useful for program debugging. -
getDebugLevel
public static int getDebugLevel()Get the debug verbosity level. -
isDebug
public static boolean isDebug()Are debugging messages requested? -
setOnceOnly
public static void setOnceOnly(boolean mode)Set a flag that indicates that repetative messages should only be displayed once. If the message is of a lower severity than the gui display level, and the OnceOnly flag is set, then the message will not be repeated. This is useful for batch mode operation to squelch the display of hundreds of lines of similar output, while not totally limiting warning messages. -
getOnceOnly
public static boolean getOnceOnly(int level)Determine if OnceOnly display mode will be used for a given message severity level. -
fatal
Display a fatal message using the default format and exit -
fatal
-
error
Display an error message using the default format -
error
-
warning
Display a warning message using the default format -
warning
-
status
Display an information message using the default format -
information
Display an information message using the default format -
debug
Display a debug message using the default format -
message
Display a message using the specified severity level, and also provide a list of option buttons. The value returned from this function will indicate the button that was selected. -
message
Display a message using the specified severity level, and also provide a list of option buttons. The value returned from this function will indicate the button that was selected. -
encodeHTMLString
This routine will encode a string using HTML-safe characters. Angle brackets (< and >) will change to < and > and quotes and line breaks are also handled. -
getAllCauses
-