类 DebugService
java.lang.Object
pkg.exoad.poprock.core.debug.DebugService
Debug Service - Utility class for handling various exceptions that can be thrown during
the runtime of this program.
Most of the things occuring here like throwing errors should only happen in development. This is especially the case because the hints provided are only able to.
Most of the things occuring here like throwing errors should only happen in development. This is especially the case because the hints provided are only able to.
- 作者:
- Jack Meng
-
嵌套类概要
-
字段概要
修饰符和类型字段说明static String
If you wish to edit this.static String
If you wish to edit this, it must follow the format accepted bySimpleDateFormat
private static PrintStream
private static boolean
private static boolean
-
构造器概要
-
方法概要
修饰符和类型方法说明static void
allowCustomStackTrace
(boolean b) Sets whether any panic messages or other messages for exceptions and errors are thrown to the print stream with a customized stack trace.static void
allowPanicking
(boolean b) Sets whether any functions depending on any of the DebugService'spanic
functions will not be able to emit anything.static boolean
canPanic()
Whether the debug service is allowed to panic the current program.static PrintStream
getOut()
static void
Macro call forDebugService.log(LogLevel.INFO,...)
static boolean
Whether the debug service is using custom stack traces for panickingstatic void
log
(DebugService.LogLevel level, Object msg) Logs a message to the console with the specified levelstatic RuntimeException
modifyThrowable
(Throwable throwable) static void
Macro call forDebugService.log(LogLevel.NOTE,...)
static void
Tells the debug service to prepare an exception right now because of an internal error.static void
Tells the debug service to prepare an exception ONLY IF the condition passed returns TRUEstatic void
Similar topanicOn(boolean,String)
but instead you can also pass a related cause of this exception.static void
static void
Instructs the service to kill the current program with a runtime exception and another exception or throwable provided.static void
Sets the internal output stream used by this debug servicestatic void
Macro call forDebugService.log(LogLevel.WARN,...)
-
字段详细资料
-
logMessageFormat
If you wish to edit this. The format defines the following tags:{0}
denotes theDebugService.LogLevel
{1}
denotes the time invoked inmm/dd/yy HH:MM:SS
format{2}
denotes the part where the message of the log entry will be shown
-
logTimeStampFormat
If you wish to edit this, it must follow the format accepted bySimpleDateFormat
-
out
-
USE_PANIC
private static boolean USE_PANIC -
USE_CUSTOM_STACK_TRACE
private static boolean USE_CUSTOM_STACK_TRACE
-
-
构造器详细资料
-
DebugService
private DebugService()
-
-
方法详细资料
-
allowCustomStackTrace
public static void allowCustomStackTrace(boolean b) Sets whether any panic messages or other messages for exceptions and errors are thrown to the print stream with a customized stack trace.This option only exists to reduce cluster in pre existing exceptions
- 参数:
b
- on or off
-
isUsingCustomStackTraces
public static boolean isUsingCustomStackTraces()Whether the debug service is using custom stack traces for panicking- 返回:
- true or false
-
allowPanicking
public static void allowPanicking(boolean b) Sets whether any functions depending on any of the DebugService'spanic
functions will not be able to emit anything.THIS IS A VERY DANGEROUS METHOD, JUST LEAVE IT ON!!
- 参数:
b
- on or off
-
canPanic
public static boolean canPanic()Whether the debug service is allowed to panic the current program. Most of the time this is set totrue
unlessallowPanicking(boolean)
is modified.- 返回:
- true or false
-
info
Macro call forDebugService.log(LogLevel.INFO,...)
- 参数:
msg
- message
-
log
Logs a message to the console with the specified level- 参数:
level
- The level of the logmsg
- The message to log
-
getOut
- 返回:
- The internal output stream used by this debug service
-
setOut
Sets the internal output stream used by this debug service- 参数:
p
- The new output stream
-
warn
Macro call forDebugService.log(LogLevel.WARN,...)
- 参数:
msg
- message
-
note
Macro call forDebugService.log(LogLevel.NOTE,...)
- 参数:
msg
- message
-
panicNow
Tells the debug service to prepare an exception right now because of an internal error. Also note this is a synchronized method meaning only ONE thread may call it at a time.- 参数:
message
- The error message. THIS SHOULD NOT BE AUTOMATICALLY GENERATED
-
panicOn
Tells the debug service to prepare an exception ONLY IF the condition passed returns TRUE- 参数:
condition
- The conditionmessage
- The message. THIS SHOULD NOT BE AUTOMATICALLY GENERATED. [This is usually the hint given to a programmer]
-
modifyThrowable
-
panicWith
Instructs the service to kill the current program with a runtime exception and another exception or throwable provided.- 参数:
e
- The other provided throwable
-
panicWith
-
panicOn
Similar topanicOn(boolean,String)
but instead you can also pass a related cause of this exception.- 参数:
condition
- The conditionmessage
- The messagecause
- The related caused exception- 另请参阅:
-