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 runtime exception is thrown.
-
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.
Notes: If the detailed log property is on, the stack trace
is also printed on every call to #log.
-
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)
- Throws a runtime exception if a given condition is false.
-
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 Also:
- 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 runtime exception is thrown.
If CompileTarget#getDebug is false, nothing happens.
- Parameters:
- cond - condition to test against
- msg - (optional) detailed message if condition fails
- Throws: RuntimeExceptionBase
- if cond is false and
CompileTarget#getDebug is true
assert
public static void assert(boolean cond,
String msg)
verify
public static void verify(boolean cond)
- Throws a runtime exception if a given condition is false.
- Parameters:
- cond - condition to test against
- msg - (optional) detailed message if condition fails
- Throws: RuntimeExceptionBase
- 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.
- Parameters:
- cond - condition to test against
- msg - (optional) detailed message if condition fails
- Throws: IllegalArgumentException
- if the 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.
- Parameters:
- cond - condition to test against
- 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.
- Parameters:
- cond - condition to test against
- 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
- is thrown
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
printStackTrace
public static void printStackTrace(PrintStream stream)
- Prints the trace of the current call stack
- Parameters:
- stream - stream to output to
log
public static void log(String message)
- Makes a general log to the log stream.
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.
- Parameters:
- message - essage to be displayed
- err - error to be displayed
- See Also:
- 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.
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.
- Parameters:
- group - name of the group
- message - message to be displayed
- err - error to be displayed
- See Also:
- 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.
- Parameters:
- 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 Also:
- 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 call to #log.
getGroupLog
public static boolean getGroupLog(String group)
- Gets the enabled state of a log group.
- Parameters:
- group - name of the group to be tested
- Returns:
- whether the specified group is enabled
setGroupLog
public static void setGroupLog(String group,
boolean log)
- Enables or disables a log group.
- Parameters:
- group - name of the group to be enabled or disabled
- log - true to enable the group; false to disable the group
- See Also:
- log
getLogMode
public static byte getLogMode()
- Gets the log mode. The default is LOG_ALL.
- Returns:
- return one of the following:
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
- Parameters:
- log - one of the following:
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 Also:
- setLogStream, log
setLogStream
public static void setLogStream(PrintStream stream)
- Sets the log stream to which logs are made
- Parameters:
- stream - log stream
- Throws: IllegalArgumentException
- if stream is null
- See Also:
- getLogStream, log
All Packages Class Hierarchy This Package Previous Next Index