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

Variable Index

 o LOG_ALL
 o LOG_FORCEALL
 o LOG_GENERAL
 o LOG_GROUPS
 o 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

Constructor Index

 o Debug()

Method Index

 o abort()
Throws a run-time exception.
 o abort(String)
 o abort(Throwable)
 o assert(boolean)
If CompileTarget#getDebug is true and if the condition cond is false, a runtime exception is thrown.
 o assert(boolean, String)
 o checkArgument(boolean)
Throws an IllegalArgumentException if a condition is false.
 o checkArgument(boolean, String)
 o checkCreated(boolean)
Throws a NotCreatedException if a condition is false.
 o checkCreated(boolean, String)
 o checkState(boolean)
Throws an InvalidStateException if a condition is false.
 o checkState(boolean, String)
 o getDetailedLog()
Gets the detailed log property.
 o getGroupLog(String)
Gets the enabled state of a log group.
 o getLogMode()
Gets the log mode.
 o getLogStream()
Gets the log stream to which logs are made
 o log(byte[])
 o log(String)
Makes a general log to the log stream.
 o log(String, byte[])
 o log(String, String)
Makes a group log to the log stream.
 o log(String, Throwable)
 o log(Throwable)
 o logThreadInfo(ThreadGroup)
Logs information describing the threads in the given group.
 o printStackTrace()
Prints the trace of the current call stack to the log stream
 o printStackTrace(PrintStream)
Prints the trace of the current call stack
 o 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.

 o setGroupLog(String, boolean)
Enables or disables a log group.
 o setLogMode(byte)
Sets the log mode
 o setLogStream(PrintStream)
Sets the log stream to which logs are made
 o verify(boolean)
Throws a runtime exception if a given condition is false.
 o verify(boolean, String)

Variables

 o 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
 o LOG_GENERAL
  public final static byte LOG_GENERAL
 o LOG_GROUPS
  public final static byte LOG_GROUPS
 o LOG_ALL
  public final static byte LOG_ALL
 o LOG_FORCEALL
  public final static byte LOG_FORCEALL

Constructors

 o Debug
  public Debug()

Methods

 o 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
 o assert
  public static void assert(boolean cond,
                            String msg)
 o 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
 o verify
  public static void verify(boolean cond,
                            String msg)
 o 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
 o checkArgument
  public static void checkArgument(boolean cond,
                                   String msg)
 o 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
 o checkState
  public static void checkState(boolean cond,
                                String msg)
 o 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
 o checkCreated
  public static void checkCreated(boolean cond,
                                  String msg)
 o abort
  public static void abort()
Throws a run-time exception.
Throws: RuntimeExceptionBase
is thrown
 o abort
  public static void abort(Throwable err)
 o abort
  public static void abort(String msg)
 o printStackTrace
  public static void printStackTrace()
Prints the trace of the current call stack to the log stream
 o printStackTrace
  public static void printStackTrace(PrintStream stream)
Prints the trace of the current call stack
Parameters:
stream - stream to output to
 o 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
 o log
  public static void log(byte message[])
 o log
  public static void log(Throwable err)
 o 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
 o log
  public static void log(String group,
                         byte message[])
 o log
  public static void log(String group,
                         Throwable err)
 o 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.
 o getDetailedLog
  public static boolean getDetailedLog()
Gets the detailed log property.
See Also:
setDetailedLog
 o 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.

 o 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
 o 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
 o 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)

 o 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)

 o getLogStream
  public static PrintStream getLogStream()
Gets the log stream to which logs are made
Returns:
the log stream
See Also:
setLogStream, log
 o 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