public class Debug extends Object
Modifier and Type | Method and Description |
---|---|
static void |
Assert(boolean check)
Check the provided assertion.
|
static void |
Assert(boolean check,
String message)
Check the provided assertion.
|
static void |
flush()
Make sure any messages are flushed to the stream.
|
static PrintStream |
getDebuggingStream()
Get the debugging stream.
|
static boolean |
getLogExceptions()
Determine if exception logging is enabled.
|
static boolean |
getLogMessages()
Determine if message logging is enabled.
|
static String |
p(String message)
Same function as
printDebuggingMessage(String) but easier to type. |
static void |
p(String location,
String message)
Same function as
printDebuggingMessage(String,String) but easier to type. |
static String |
printDebuggingMessage(String message)
Print the provided message to the debug log (if message logging is on).
|
static void |
printDebuggingMessage(String location,
String message)
Print the provided message to the debug log (if message logging is on).
|
static void |
reportException(Throwable e)
Report the Exception (or Throwable) to the debug log.
|
static void |
reportException(Throwable e,
String message)
Report the exception to the debug log.
|
static void |
setDebuggingStream(PrintStream w)
Set the debugging stream.
|
static void |
setLogExceptions(boolean on)
Turn on/off the logging of reported exceptions.
|
static void |
setLogMessages(boolean on)
Set whether debugging messages will be logged to the debug stream.
|
static void |
setThreadNameOutput(boolean on)
Turn on/off the reporting of thread name in the debug log.
|
public static void setDebuggingStream(PrintStream w)
w
- The stream where debug output will be directed.public static PrintStream getDebuggingStream()
public static void setLogMessages(boolean on)
on
- Whether or not printed debug messages will go to the log.public static boolean getLogMessages()
public static void setLogExceptions(boolean on)
on
- Whtehr or not reported exceptions will be directed to the log.public static boolean getLogExceptions()
public static void setThreadNameOutput(boolean on)
on
- Whether or not the thread name will appear in the output.public static void reportException(Throwable e, String message)
e
- The exception to report.message
- Additional information to report along with the exception.public static void reportException(Throwable e)
e
- The exception to report.public static String printDebuggingMessage(String message)
message
- The message to report.public static void printDebuggingMessage(String location, String message)
location
- A string indicating which part of code is generating the message.message
- The message to log.public static String p(String message)
printDebuggingMessage(String)
but easier to type.public static void p(String location, String message)
printDebuggingMessage(String,String)
but easier to type.public static void Assert(boolean check) throws AssertionFailedException
check
- The result of the assertion check, which should be false if it fails.AssertionFailedException
- thrown if the method parameter is false.public static void Assert(boolean check, String message) throws AssertionFailedException
check
- Whether or not to throw the exception.message
- A message to include in the thrown exception.AssertionFailedException
- thrown if the condition evaluates to false.public static void flush()
Copyright © 2019. All rights reserved.