Class powersoft.jcm.util.Debug
All Packages Class Hierarchy This Package Previous Next Index
Class powersoft.jcm.util.Debug
java.lang.Object
|
+----powersoft.jcm.util.Debug
- public class Debug
- extends Object
-
LOG_ALL
-
-
LOG_FORCEALL
-
-
LOG_GENERAL
-
-
LOG_GROUPS
-
-
LOG_NONE
- constants used in the LogMode property
LOG_NONE - no logs
LOG_GENERAL - enables general logs only
LOG_GROUPS - enables group logs only
LOG_ALL - enables general and group logs
LOG_FORCEALL - enables general and group logs, plus the group
logs that have not been enabled by setGroupLog
-
Debug()
-
-
abort()
- Throws a run-time exception.
-
abort(String)
-
-
abort(Throwable)
-
-
assert(boolean)
- If CompileTarget.getDebug() is true and if the condition cond
is false, a message box comes up and you can choose to:
exit the program, or
ignore the assertion fault and continue.
-
assert(boolean, String)
-
-
checkArgument(boolean)
- Throws an IllegalArgumentException if a condition is false.
-
checkArgument(boolean, String)
-
-
checkCreated(boolean)
- Throws a NotCreatedException if a condition is false.
-
checkCreated(boolean, String)
-
-
checkState(boolean)
- Throws an InvalidStateException if a condition is false.
-
checkState(boolean, String)
-
-
getDetailedLog()
- Gets the detailed log property.
-
getGroupLog(String)
- Gets the enabled state of a log group.
-
getLogMode()
- Gets the log mode.
-
getLogStream()
- gets the log stream to which logs are made
-
log(byte[])
-
-
log(String)
- Makes a general log to the log stream.
-
log(String, byte[])
-
-
log(String, String)
- Makes a group log to the log stream.
-
log(String, Throwable)
-
-
log(Throwable)
-
-
logThreadInfo(ThreadGroup)
- Logs information describing the threads in the given group.
-
printStackTrace()
- prints the trace of the current call stack to the log stream
-
printStackTrace(PrintStream)
- prints the trace of the current call stack
-
setDetailedLog(boolean)
- Sets the detailed log property.
-
setGroupLog(String, boolean)
- Enables or disables a log group.
-
setLogMode(byte)
- Sets the log mode
-
setLogStream(PrintStream)
- sets the log stream to which logs are made
-
verify(boolean)
- If CompileTarget.getDebug() is true and if the condition cond
is false, a message box comes up and you can choose to:
exit the program, or
throw a runtime exception, or
ignore the assertion fault and continue.
-
verify(boolean, String)
-
LOG_NONE
public final static byte LOG_NONE
- constants used in the LogMode property
LOG_NONE - no logs
LOG_GENERAL - enables general logs only
LOG_GROUPS - enables group logs only
LOG_ALL - enables general and group logs
LOG_FORCEALL - enables general and group logs, plus the group
logs that have not been enabled by setGroupLog
@see #setLogMode, #log, #setGroupLog
LOG_GENERAL
public final static byte LOG_GENERAL
LOG_GROUPS
public final static byte LOG_GROUPS
LOG_ALL
public final static byte LOG_ALL
LOG_FORCEALL
public final static byte LOG_FORCEALL
Debug
public Debug()
assert
public static void assert(boolean cond)
- If CompileTarget.getDebug() is true and if the condition cond
is false, a message box comes up and you can choose to:
exit the program, or
ignore the assertion fault and continue.
If CompileTarget.getDebug() is false, nothing happens.
@parm cond condition to test against
@parm msg (optional) detailed message if condition fails
assert
public static void assert(boolean cond,
String msg)
verify
public static void verify(boolean cond)
- If CompileTarget.getDebug() is true and if the condition cond
is false, a message box comes up and you can choose to:
exit the program, or
throw a runtime exception, or
ignore the assertion fault and continue.
If CompileTarget.getDebug() is false and if the condition cond
is false, a runtime exception is thrown.
@parm cond condition to test against
@parm msg (optional) detailed message if condition fails
@exception RuntimeException if cond is false
verify
public static void verify(boolean cond,
String msg)
checkArgument
public static void checkArgument(boolean cond)
- Throws an IllegalArgumentException if a condition is false.
@parm cond condition to test against
@parm msg (optional) detailed message if condition fails
@throws IllegalArugmentException if condition fails
checkArgument
public static void checkArgument(boolean cond,
String msg)
checkState
public static void checkState(boolean cond)
- Throws an InvalidStateException if a condition is false.
@parm cond condition to test against
@parm msg (optional) detailed message if condition fails
@throws InvalidStateException if condition fails
checkState
public static void checkState(boolean cond,
String msg)
checkCreated
public static void checkCreated(boolean cond)
- Throws a NotCreatedException if a condition is false.
@parm cond condition to test against
@parm msg (optional) detailed message if condition fails
@throws NotCreatedException if condition fails
checkCreated
public static void checkCreated(boolean cond,
String msg)
abort
public static void abort()
- Throws a run-time exception.
@throws RuntimeExceptionBase
abort
public static void abort(Throwable err)
abort
public static void abort(String msg)
printStackTrace
public static void printStackTrace()
- prints the trace of the current call stack to the log stream
@parm stream (optional) - stream to output
printStackTrace
public static void printStackTrace(PrintStream stream)
- prints the trace of the current call stack
@parm stream - stream to output to
log
public static void log(String message)
- Makes a general log to the log stream.
@parm message - message to be displayed
@parm err - error to be displayed
@notes General logs can be enabled by setting the property LogMode
to LOG_GENERAL, LOG_ALL or LOG_FORCEALL. General logs are
disabled if the LogMode property is set to LOG_NONE or
LOG_GROUPS.
@see #setLogMode
log
public static void log(byte message[])
log
public static void log(Throwable err)
log
public static void log(String group,
String message)
- Makes a group log to the log stream.
@parm group - name of the group
@parm message - message to be displayed
@parm err - error to be displayed
@notes Each group log can be enabled or disabled using #setGroupLog.
You can enable all group logs by setting the property LogMode
to LOG_FORCEALL, or disable all group logs by setting the
property LogMode to LOG_NONE or LOG_GENERAL.
@see #setGroupLog, #setLogMode
log
public static void log(String group,
byte message[])
log
public static void log(String group,
Throwable err)
logThreadInfo
public static void logThreadInfo(ThreadGroup group)
- Logs information describing the threads in the given group.
@param group The thread group to log. If null, the group of the
current thread is used.
getDetailedLog
public static boolean getDetailedLog()
- Gets the detailed log property.
@see setDetailedLog
setDetailedLog
public static void setDetailedLog(boolean detailedLog)
- Sets the detailed log property.
@notes If the detailed log property is on, the stack trace is also
printed on every log.
getGroupLog
public static boolean getGroupLog(String group)
- Gets the enabled state of a log group.
setGroupLog
public static void setGroupLog(String group,
boolean log)
- Enables or disables a log group.
@see #log
getLogMode
public static byte getLogMode()
- Gets the log mode. The default is LOG_ALL.
@returns:
LOG_NONE - no logs
LOG_GENERAL - general logs only
LOG_GROUPS - enabled group logs only
LOG_ALL - general and enabled group logs
LOG_FORCEALL - all logs (including disabled logs)
setLogMode
public static void setLogMode(byte log)
- Sets the log mode
@parm log:
LOG_NONE - no logs
LOG_GENERAL - general logs only
LOG_GROUPS - enabled group logs only
LOG_ALL - general and enabled group logs
LOG_FORCEALL - all logs (including disabled logs)
getLogStream
public static PrintStream getLogStream()
- gets the log stream to which logs are made
@returns the log stream
@see #setLogStream, #log
setLogStream
public static void setLogStream(PrintStream stream)
- sets the log stream to which logs are made
@parm stream log stream
@exception IllegalArugmentException if stream is null
@see #getLogStream, #log
All Packages Class Hierarchy This Package Previous Next Index